Code::Blocks

User forums => Help => Topic started by: zorro on December 07, 2006, 09:03:09 am

Title: How to use both Debug and Release builds of wx libraries?
Post by: zorro on December 07, 2006, 09:03:09 am
I've followed the instructions on wiki.wxwidgets.org for building both Debug and Release libraries for wx. The (dynamic) libraries for both versions are located in the same gcc_dll directory. According to wiki.wxwidgets.org you should rename these gcc_dlls in order to have several builds.
But how do I tell C::B that for a debug version of my application, wx-libraries are located in gcc_dll_debug and for a release version in gcc_dll_release? I'm using the latest nightly built of C::B.
Title: Re: How to use both Debug and Release builds of wx libraries?
Post by: dje on December 07, 2006, 09:32:11 am
Hi !!

The solution is in the Build options.

- Click on the project on the tree.
- Click on the Directories tabs then on the linker tab
- Put all target independant lib directories
- Click on the debug target
- Put gcc_dll_debug dir
- Click on the release target
- Put gcc_dll_release dir

You may use custom variables too and set usage at project level:
For my plugin, I use the dir $(#wx.lib)\gcc_dll$(WX_CFG)
I set the values on the "custom variables tab"
WX_CFG =

Dje
Title: Re: How to use both Debug and Release builds of wx libraries?
Post by: stahta01 on December 07, 2006, 10:15:28 am
I've followed the instructions on wiki.wxwidgets.org for building both Debug and Release libraries for wx. The (dynamic) libraries for both versions are located in the same gcc_dll directory. According to wiki.wxwidgets.org you should rename these gcc_dlls in order to have several builds.
But how do I tell C::B that for a debug version of my application, wx-libraries are located in gcc_dll_debug and for a release version in gcc_dll_release? I'm using the latest nightly built of C::B.

I would use the default method of doing it and the default folder naming.

Using these C::B custom varibles
WX_SUFFIX=""  // ANSI Release
WX_SUFFIX="d"  // ANSI Debug
WX_SUFFIX="u"  // Unicode Release
WX_SUFFIX="ud"  // Unicode debug

I use WX_CFG when I am using a special configuration
WX_CFG="rc3"

Remember WX needs to point to the wxWidgets folder.

Example minGW build command for "Unicode debug" 2.8.0 RC3

mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug   UNICODE=1

Note: vendor just puts rc3 in the DLL name; CFG sets which folder the DLL is placed in.
In this case in lib\gcc_dllrc3

Note: Before using CFG in the mingw32-make build you need to build with using it; else the build errors out.

Note: __WXDEBUG__ must be defined (in the codeblocks project setting) if your wish to link against the  debug version of wxWidgets DLL. Else you will get a runtime error, when you try to run your project output.

Tim S


Title: Re: How to use both Debug and Release builds of wx libraries?
Post by: Pecan on December 07, 2006, 02:23:12 pm
Note: Before using CFG in the mingw32-make build you need to build with using it; else the build errors out.

Nice explanation. But...

What do you mean by the above quote? Did you mean " Before using CFG in the project, you need to ..." ??
Title: Re: How to use both Debug and Release builds of wx libraries?
Post by: stahta01 on December 07, 2006, 03:00:59 pm
Note: Before using CFG in the mingw32-make build you need to build with using it; else the build errors out.

Nice explanation. But...

What do you mean by the above quote? Did you mean " Before using CFG in the project, you need to ..." ??

I have never got the following command to work
mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug   UNICODE=1

unless I have ran this command on the same wxWidgets folders
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug   UNICODE=1

I am guessing that the build without the CFG creates a file or directory needed by the build with the CFG.

Tim S
Title: Re: How to use both Debug and Release builds of wx libraries?
Post by: Pecan on December 07, 2006, 03:37:15 pm
I have never got the following command to work
mingw32-make -f makefile.gcc VENDOR=rc3 CFG=rc3 USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug   UNICODE=1

unless I have ran this command on the same wxWidgets folders
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=debug   UNICODE=1

I am guessing that the build without the CFG creates a file or directory needed by the build with the CFG.

Tim S


Thank you, added to: FAQ (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_use_both_Debug_and_Release_builds_of_wx_libraries.3F)