I tried to build a program with static lib, I did not choose "use wxwidgets dll" in the project wizard.
selecting all in this step won compile either. I searched how to build a static link and some said instead of selecting all, some libraries should not be selected:
then the program can be compiled, and runs without dll.
I don't think I understood the meaning of "additional libraries", as those libraries, at least some of the libraries seem to be necessary instead of additional. Have I mixed any concepts?
Then I am wondering if there's a setting that allows the compiler to auto-select the libraries the program requires, for I really don't want to manually select libraries every time I build a project. And I believe the "hello world program" doesn't in fact require all the libraries selected, will this increase the size of the exe?
And I also find a problem when I want to create both release and debug version of the program. I tick both in the wizard, but the bin file contains only the debug version. If I tick release only, then there will be a release version. Does this mean that CB only builds one version a time? Then how can I build both versions?
Edit: Subject edited to reflect that it's a Code::Blocks question.
DavidHart. Moderator
at first I neglected the following step
which turned out unable to compiled.Code::Blocks: building a program with static lib Topic is solved
Code::Blocks: building a program with static lib
Last edited by DavidHart on Fri Aug 18, 2017 2:13 pm, edited 1 time in total.
Reason: Change the topic to reflect that it's a Code::Blocks question
Reason: Change the topic to reflect that it's a Code::Blocks question
Re: Code::Blocks: building a program with static lib
Hi,
1. All those libraries that are displayed as "Additional libraries" are in fact additional libraries. Let me explain.
There are only 2 main libraries in wxWidgets - wxBase and wxCore. wxBase is the library that contains all non-GUI stuff - string and STL-like classes. wxCore is the library that contains all standard GUI control (frame, button, list, combo box, etc).
Now, here are the list of an additional libraries as it appears in the list:
- wxXrc - this is the library that contains the resource handling. If you look at Windows MSVC, you will see that it is able to create different resources (dialogs, bitmaps, etc) and store it in the rc (resource) file. Then the program can read this rc file and create an actual windows/resources/etc on the screen. This library will do essentially the same thing - load the externally created resources and generate the appropriate resources on the screen.
- wxDbGrid/wxOdbc - those libraries were available up to version 2.8. They were removed in version 3.0. They are basically a wrapper around the ODBC Open Source library called iODBC. They were removed in favour of the programmer using something that is explicitly designed to work with databases.
- wxMedia - this is the library that wraps around native media control. It will allow the developer to create a native movie/music player and play movie/music.
- wxNet - this library contains classes that wraps around the network accesses (HTTP, FTP, sockets).
- wxGl - a wraper around OpenGL (3D rendering framework).
-wxQa - some additional classes to do testing/quality assurance. They were used in the past but nowadays nobody uses it probably.
- wxXml - a library that is used to read, parse and write an XML files.
- wxAdv - this is an advanced library that contains some advanced controls (namely wxGrid and wxOwnerDrawnComboBox being the biggest 2).
- wxHtml - same as wxXml buit for HTML4. No HTML5 support is available.
- wxJpeg, wxTiff - the are the wrappers around library that reads and writes the appropriate bitmapo formts.
- wxRegex - this library will soon be obsolete in favour of the standard regex in c++11. But since wxWidgets still supports an older compiler this will not happen very soon.
- wxExpat - it is a wxWidgets wrapper around expat XML parsing library.
Now only you as a developer of the software that uses wxWidgets will know what features you program will use. And therefore you will know which libraries besides wxBase and wxCore you will need to link against. Now most, ifnot all, of the current linkers are smart enough to choose the required libraries according to the propgram needs. So if you link against all of them its not an error. However it is better to not to do that and link only the library that your program needs. Just refer to the explanation above.
2. The C::B IDE probably is not smart enough and can't compile 2 different configurations at one shot. You just need to create a new configuration and switch to the new configuration and build it independently. I don't have an experience working with this IDE, so can't tell for sure. I know MSVC is able to do that, since it has a menu "Build->Batch Build..." where you can select multiple configuration t be built. But I have no idea about C::B. You will just have to build it one by one.
Thank you.
1. All those libraries that are displayed as "Additional libraries" are in fact additional libraries. Let me explain.
There are only 2 main libraries in wxWidgets - wxBase and wxCore. wxBase is the library that contains all non-GUI stuff - string and STL-like classes. wxCore is the library that contains all standard GUI control (frame, button, list, combo box, etc).
Now, here are the list of an additional libraries as it appears in the list:
- wxXrc - this is the library that contains the resource handling. If you look at Windows MSVC, you will see that it is able to create different resources (dialogs, bitmaps, etc) and store it in the rc (resource) file. Then the program can read this rc file and create an actual windows/resources/etc on the screen. This library will do essentially the same thing - load the externally created resources and generate the appropriate resources on the screen.
- wxDbGrid/wxOdbc - those libraries were available up to version 2.8. They were removed in version 3.0. They are basically a wrapper around the ODBC Open Source library called iODBC. They were removed in favour of the programmer using something that is explicitly designed to work with databases.
- wxMedia - this is the library that wraps around native media control. It will allow the developer to create a native movie/music player and play movie/music.
- wxNet - this library contains classes that wraps around the network accesses (HTTP, FTP, sockets).
- wxGl - a wraper around OpenGL (3D rendering framework).
-wxQa - some additional classes to do testing/quality assurance. They were used in the past but nowadays nobody uses it probably.
- wxXml - a library that is used to read, parse and write an XML files.
- wxAdv - this is an advanced library that contains some advanced controls (namely wxGrid and wxOwnerDrawnComboBox being the biggest 2).
- wxHtml - same as wxXml buit for HTML4. No HTML5 support is available.
- wxJpeg, wxTiff - the are the wrappers around library that reads and writes the appropriate bitmapo formts.
- wxRegex - this library will soon be obsolete in favour of the standard regex in c++11. But since wxWidgets still supports an older compiler this will not happen very soon.
- wxExpat - it is a wxWidgets wrapper around expat XML parsing library.
Now only you as a developer of the software that uses wxWidgets will know what features you program will use. And therefore you will know which libraries besides wxBase and wxCore you will need to link against. Now most, ifnot all, of the current linkers are smart enough to choose the required libraries according to the propgram needs. So if you link against all of them its not an error. However it is better to not to do that and link only the library that your program needs. Just refer to the explanation above.
2. The C::B IDE probably is not smart enough and can't compile 2 different configurations at one shot. You just need to create a new configuration and switch to the new configuration and build it independently. I don't have an experience working with this IDE, so can't tell for sure. I know MSVC is able to do that, since it has a menu "Build->Batch Build..." where you can select multiple configuration t be built. But I have no idea about C::B. You will just have to build it one by one.
Thank you.
Re: Code::Blocks: building a program with static lib
C::B does allow compiling all "targets" (debug, release, or whatever you have created) in one shot.
Re: Code::Blocks: building a program with static lib
THANK YOU VERY MUCH, ONEEYEMAN. Your detailed explanation is very helpful!ONEEYEMAN wrote:Hi,
1. All those libraries that are displayed as "Additional libraries" are in fact additional libraries. Let me explain.
There are only 2 main libraries in wxWidgets - wxBase and wxCore. wxBase is the library that contains all non-GUI stuff - string and STL-like classes. wxCore is the library that contains all standard GUI control (frame, button, list, combo box, etc).
......
Indeed, I have another question: what if I link the additional library to a dynamically linked program? Building a program with dlls does not require any of the additional libraries, at least it works if I don't choose any, but it requires dlls. So if I linked those libraries, does it mean that the program eventually won't rely on dlls?
Re: Code::Blocks: building a program with static lib
Thanks for replying.Manolo wrote:C::B does allow compiling all "targets" (debug, release, or whatever you have created) in one shot.
I asked the question because I chose both versions in the "wizard": but I only get the debug version in the bin file. I checked settings in "properties", it looks like this: I don't see any problem here. Maybe I should check the compiler option?
-
- Super wx Problem Solver
- Posts: 465
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Code::Blocks: building a program with static lib
Are you asking you to change which target to build? If so, you can do this by selecting a different target in the toolbar
or in the build menu.
After making the change, the build command will build the new target.Re: Code::Blocks: building a program with static lib
Thanks a lot!New Pagodi wrote:Are you asking you to change which target to build? If so, you can do this by selecting a different target in the toolbar
or in the build menu.