Eclipse project configuration for wxWidgets

Let’s see how to configure an eclipse project to take wxWidgets into account.
In this page, we will assume you have already installed the free MinGW/MSYS/Eclipse/CDT environment. If not, you can learn how to do this on this page.
We assume that wxWidgets is also correctly installed. If it is not the case, check this tutorial.
Think to adapt the paths to your own choices.

First, open the project properties dialog, select the C/C++ Build item and then the Tool Settings tab.

Debug mode

Select Debug in the Configuration droplist.

Preprocessor

Select the GCC C++ Compiler → Preprocessor item, and add those defined symbols (-D):

__WXMSW__
__WX_PRECOMP
NO_GCC_PRAGMA
__WXDEBUG__

Directories

Select the GCC C++ Compiler → Directories item, and add those Include Paths (-I):

C:\Software\Development\wxWidgets-2.6.3\build-debug\lib\wx\include\msw-ansi-debug-static-2.6
C:\Software\Development\wxWidgets-2.6.3\include

Libraries

Select the GCC C++ Linker → Libraries item, and add these Libraries (-l):

wx_mswd_core-2.6
wx_based-2.6
wxtiffd-2.6
wxjpegd-2.6
wxpngd-2.6
wxzlibd-2.6
wxregexd-2.6
wxexpatd-2.6
rpcrt4
oleaut32
ole32
uuid
winspool
winmm
shell32
comctl32
comdlg32
ctl3d32
advapi32
wsock32
gdi32

For OpenGL, add the following in the same place:

wx_mswd_gl-2.6
opengl32
glu32

Add this Library search path (-L):

C:\Software\Development\wxWidgets-2.6.3\build-debug\lib

Miscellaneous

Select the GCC C++ Linker → Miscellaneous item, and set this as Linker flags:

-mwindows

It will remove the DOS command window when you run your application.

If you need to throw exception from your thread routine, add this flag in both GCC C++ Compiler → Miscellaneous and GCC C++ Linker → Miscellaneous items:

-mthreads

It causes your exe to link with mingwm10.dll (so you will need to ship your program with that dependency). This DLL can be found in:

C:\Software\Development\MinGW\bin\mingwm10.dll

It has to be a DLL (and can’t be linked statically) because whenever a thread exits, the thread-local storage that was allocated for thread-safe C++ exception handling must be freed. On Windows, the only way to be notified when a thread exits is in the DllMain function.

Release mode

Select Release in the Configuration droplist.

Preprocessor

Select the GCC C++ Compiler → Preprocessor item, and add those defined symbols (-D):

__WXMSW__
WX_PRECOMP
NO_GCC_PRAGMA

Directories

Select the GCC C++ Compiler → Directories item, and add those Include Paths (-I):

C:\Software\Development\wxWidgets-2.6.3\build-release\lib\wx\include\msw-ansi-release-static-2.6
C:\Software\Development\wxWidgets-2.6.3\include

Libraries

Select the GCC C++ Linker → Libraries item, and add these Libraries (-l):

wx_msw_core-2.6
wx_base-2.6
wxtiff-2.6
wxjpeg-2.6
wxpng-2.6
wxzlib-2.6
wxregex-2.6
wxexpat-2.6
rpcrt4
oleaut32
ole32
uuid
winspool
winmm
shell32
comctl32
comdlg32
ctl3d32
advapi32
wsock32
gdi32

For OpenGL, add the following in the same place:

wx_msw_gl-2.6
opengl32
glu32

Add this Library search path (-L):

C:\Software\Development\wxWidgets-2.6.3\build-release\lib

Miscellaneous

Select the GCC C++ Linker → Miscellaneous item, and set this as Linker flags:

-mwindows

It will remove the DOS command window when you run your application.

If you need to throw exception from your thread routine, add this flag in both GCC C++ Compiler → Miscellaneous and GCC C++ Linker → Miscellaneous items:

-mthreads

It causes your exe to link with mingwm10.dll (so you will need to ship your program with that dependency). This DLL can be found in:

C:\Software\Development\MinGW\bin\mingwm10.dll

It has to be a DLL (and can’t be linked statically) because whenever a thread exits, the thread-local storage that was allocated for thread-safe C++ exception handling must be freed. On Windows, the only way to be notified when a thread exits is in the DllMain function.

Sample program

Now you should be able to build a sample program in wxWidgets. You could try this one for instance: it will build an application named hworld.exe.

Gaining space in binaries

If you find the generated binaries too heavy, you can discard symbols from it by using the strip command:

strip.exe hworld.exe
 
configure_project.txt · Last modified: 22:31 30/12/2008
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
SourceForge.net 
Logo