Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: 00061205 on July 21, 2008, 09:32:14 am

Title: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 21, 2008, 09:32:14 am
I checked the "use wxWidgets dll" option when I create my project. However, now I want to link my app to a static library. What I should do?
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: TDragon on July 21, 2008, 05:05:45 pm
1. If you aren't using wxPack, ensure that you've built wxWidgets as a static library (SHARED=0).
2. In the Linker search directories of your project's Build options, alter the path ending in "gcc_dll" to end in "gcc_lib".
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 22, 2008, 05:08:12 am
1. If you aren't using wxPack, ensure that you've built wxWidgets as a static library (SHARED=0).
2. In the Linker search directories of your project's Build options, alter the path ending in "gcc_dll" to end in "gcc_lib".
Yes, I'm using wxPack. However, after I alter the gcc_dll to end in gcc_lib the project can't compile successfully
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: TDragon on July 22, 2008, 04:53:41 pm
Ah yes, I forgot that there are additional libraries that need to be brought in.
Try adding the following (to the Link libraries list under the Linker settings tab):
libwxpng.a
libwxzlib.a
libkernel32.a
libuser32.a
libgdi32.a
libwinspool.a
libcomdlg32.a
libadvapi32.a
libshell32.a
libole32.a
liboleaut32.a
libuuid.a
libcomctl32.a
libwsock32.a
libodbc32.a

These are the libraries that normally get brought in when the DLL is created, but which you have to bring in yourself when using the non-DLL version.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 23, 2008, 04:57:00 am
Ah yes, I forgot that there are additional libraries that need to be brought in.
Try adding the following (to the Link libraries list under the Linker settings tab):
libwxpng.a
libwxzlib.a
libkernel32.a
libuser32.a
libgdi32.a
libwinspool.a
libcomdlg32.a
libadvapi32.a
libshell32.a
libole32.a
liboleaut32.a
libuuid.a
libcomctl32.a
libwsock32.a
libodbc32.a

These are the libraries that normally get brought in when the DLL is created, but which you have to bring in yourself when using the non-DLL version.
wow! So complicated. Maybe the developers could improve that in the next nighty build.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: TDragon on July 23, 2008, 08:23:27 am
This has nothing to do with Code::Blocks; it's just a fact of life when working with libraries in C/C++.

In fact, if you re-run the wxWidgets project wizard and select a non-DLL build, Code::Blocks will fill in these additional libraries for you; I merely copied them.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: pasgui on July 23, 2008, 10:51:33 am
I think wx-config for windows (http://wxconfig.googlepages.com/) can manage the declaration like under linux.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: dje on July 23, 2008, 11:34:07 am
looks nice  :P
Did you try it ?
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: pasgui on July 23, 2008, 01:39:06 pm
Did you try it ?
Yes, I don't remember if it was with static or dynamic wxWidgets library but under C::B, you can configure your project for Linux and Windows, only add in the variables definition, the path for the executable and some environment variable needed for wx-config.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 24, 2008, 04:10:36 am
This has nothing to do with Code::Blocks; it's just a fact of life when working with libraries in C/C++.

In fact, if you re-run the wxWidgets project wizard and select a non-DLL build, Code::Blocks will fill in these additional libraries for you; I merely copied them.
How to re-run the wxWidgets project wizard without overwrite my project?
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: TDragon on July 24, 2008, 04:36:17 am
You can't; thus the need to add all these additional libraries by hand. See above re: facts of life.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: Biplab on July 24, 2008, 06:21:34 am
How to re-run the wxWidgets project wizard without overwrite my project?

1) Open the project.
2) File > New > Build Target...
3) Select wxWidgets and follow the steps.

Please note that this will work if you don't change your project compiler.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 24, 2008, 07:39:58 am
How to re-run the wxWidgets project wizard without overwrite my project?

1) Open the project.
2) File > New > Build Target...
3) Select wxWidgets and follow the steps.

Please note that this will work if you don't change your project compiler.
This method doesn't work. A lot of link errors show up. The libs must be add manually after re-run the wxWidgets project.
libwxpng.a
libwxzlib.a
libkernel32.a
libuser32.a
libgdi32.a
libwinspool.a
libcomdlg32.a
libadvapi32.a
libshell32.a
libole32.a
liboleaut32.a
libuuid.a
libcomctl32.a
libwsock32.a
libodbc32.a

Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: 00061205 on July 24, 2008, 08:09:35 am
I found a way to solve this problem.
Open your project and then:
1.file->new->project
2.select wxWidgets project. next->next->next->next->next->next
3.uncheck the "Use wxWidgets DLL";check the "Create Empty Project"
4.right click the project name in management->projects windows->add files
4.add all source files.
6.build project.
Title: Re: How to change the "wxWidgets library settings" in a created project?
Post by: Biplab on July 24, 2008, 09:34:10 am
This method doesn't work. A lot of link errors show up. The libs must be add manually after re-run the wxWidgets project.

You've found a bug. A refactoring of wxWidgets wizard is necessary.