Archive

Posts Tagged ‘wxwidgets’

Error: Can not start thread: error writing TLS. (error 87: the parameter is incorrect.)

February 18th, 2009 No comments

When I tried building an multi-thread TUI application using wxWidgets framework, I got the following error while executing the application.

Error: Can not start thread: error writing TLS. (error 87: the parameter is incorrect.)

I was not able to reason out this behavior. I tried changing between THREAD_DETACHABLE and THREAD_JOINABLE, but was not able to get through.  When I search for hints from the web, I got the following link.

http://osdir.com/ml/lib.wxwindows.general/2004-01/msg00759.html

It was advised to create a dummy wxInitializer object so that the wxWidgets platform does the necessary initialization.  wxInitializer class is an undocumented class and called internally when a wxFrame or wxDialog based GUI application is built.  Typically, wxInitializer object is instantiated internally by the wxApp class.  Since, in my application there is no wxApp object which led to the above problem

When I dug the declaration of wxInitializer class, I found it declared at wx/init.h;  Also I found that instead of instantiating the object, we may call the following function.

extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL);

In my application, I did the following:

main( int argc, char **argv )
{
      extern bool wxInitialize( int, char ** );
      wxInitialize( argc, argv );
      ….
      ….
}

It worked like piece of cream.

Powered by ScribeFire.

Linker Error while compiling wxWidgets application in Visual Studio 6

July 17th, 2008 No comments
——————–Configuration: SVDui – Win32 Debug——————–
Linking…
wxmsw28d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__InitCommonControls@0
wxmsw28d_core.lib(spinbutt.obj) : error LNK2001: unresolved external symbol __imp__CreateUpDownControl@48
wxmsw28d_core.lib(statbr95.obj) : error LNK2001: unresolved external symbol __imp__CreateStatusWindowA@16
wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Draw@24
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Draw@24
wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetImageCount@4
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetImageCount@4
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Create@20
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Create@20
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Destroy@4
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Destroy@4
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Add@12
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Add@12
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_AddMasked@12
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_ReplaceIcon@12
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_ReplaceIcon@12
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Replace@16
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Remove@8
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_SetBkColor@8
wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIcon@12
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_SetDragCursorImage@16
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_BeginDrag@16
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_EndDrag@0
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragMove@8
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragEnter@12
wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragLeave@4
wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidToStringA@8
wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__RpcStringFreeA@4
wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidCreate@4
wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidFromStringA@8
Debug/SVDui.exe : fatal error LNK1120: 25 unresolved externals
Error executing link.exe.

SVDui.exe – 33 error(s), 0 warning(s)

The solution to the above problem is to add “rpcrt.lib comctl32.lib” at project settings->Link->object/library modules
along with “kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib”.

Developing GUI Applications in C++ with wxWidgets

July 17th, 2008 No comments

Who said C++ cannot be used for Rapid
Application Development (RAD) ? There are many GUI frameworks for C++,
which are even portable across Unix, Windows and others. One such
framework is wxWidgets.

wxWidgets lets developers create applications for Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more using one codebase. It can be used from languages such as C++, Python, Perl, and C#/.NET. Unlike other cross-platform toolkits, wxWidgets applications look and feel native. This is because wxWidgets uses the platform’s own native controls rather than emulating them. It’s also extensive, free, open-source, and mature.

wxWidgets
is not just a GUI framework. It provides native support for threads,
sockets, database connectivity, synchronization and what else. Qt also
provides such support, but I like wxWidgets for its simplicity is
programming use.

There is a RAD development tool called wx-devcpp
hosted at sourceforge, which helps faster creation of Frames, Controls,
Dialogs and more. wx-devcpp has support for Visual Studio 2005
compilation as well along with MinGW compilation in Windows. I use
wx-devcpp for forms creations and import the generated source to VS6.0
in Windows and KDevelop in my Fedora 7. The surprise is, the code
compiles with very minimal changes from VS6.0 to KDevelop environment.
I have used wxWidgets with STLport 5.1 for my development purposes.