Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: m15981 on February 10, 2006, 05:44:59 am

Title: Newbie wants to make a release version
Post by: m15981 on February 10, 2006, 05:44:59 am
Hi
I have just finished my first app and i was wondering how can i make
a release version of it? You know like in VS that when you compile
you can select between a debug and a release version.
Thank you
Title: Re: Newbie wants to make a release version
Post by: TDragon on February 10, 2006, 05:50:34 am
The only differences between debug and release versions in any compiler or IDE are the compiler settings. In any compiler, this usually involves:
For GCC, these would be the -g, -On, -D, and -s switches respectively.
Title: Re: Newbie wants to make a release version
Post by: jc on February 10, 2006, 11:22:37 am
The best way to do this is to set up two different targets (if you imported a VC project, it may already be done this way), one for release, and one for debug. In that case simply clicking on the "Build target:" dialoug under the menu bar (blue buttons) will bring up the Release option.

You can add or change different targets in: Right click project -> Properties -> Targets, these allow you to change the compiler flags for each target.

To turn debugging on or off you just go to: Right click project -> Properties -> Project's build options... -> Compiler flags -> check/uncheck debugging. Other options like optimization are going to be in "Compiler flags," too.
Title: Re: Newbie wants to make a release version
Post by: m15981 on February 10, 2006, 04:40:42 pm
Great thank you both for your help but i have another question
When i make a release version with no debug flags and optimisations
and i try to execute the .exe it gives me an error for the dll missing.
How can i change this so when i give the executable there is no need
to give the dll as well?
Thx
Title: Re: Newbie wants to make a release version
Post by: thomas on February 10, 2006, 04:46:42 pm
If you do not want to distribute "the dll" (what dll?), then you have to statically link instead of dynamically (increases executable size). Of course, it somehow depends on what "the" dll is, too.
Title: Re: Newbie wants to make a release version
Post by: m15981 on February 10, 2006, 04:54:30 pm
It gives me an error for the wxWidgets dll wxmsw26u_gcc_custom.dll.
Title: Re: Newbie wants to make a release version
Post by: thomas on February 10, 2006, 05:35:41 pm
Aha... three possibilities:

1. Copy that dll (found in the lib folder of your wxWidgets build) to the Windows folder or another location which is in the path. This is one recommended way of doing it while developing, but it is not suitable for distribution unless you at least change the vendor name.

2. Always copy that dll to the same directory as the executable. This is another recommended way of doing it while developing, and it is suitable for distribution, too (but you should change the vendor from "custom" to your own name anyway).

3. Build wxWidgets for static linkage (i.e. with SHARED=0) or simply link with the static libraries in case you use a binary distribution (use the static template, and make sure you do not define WXUSINGDLL).

Static linkage has the disadvantage of generating a larger executable, but it can cause no versioning conflicts. Dynamic linkage has the issue of "DLL hell", but it generates a smaller executable (does not matter if you only distribute one program, as the code just goes into the dll instead), saves time during the development cycle, and possibly allows to reuse the same code (if you write several programs using the same version of the same dll and you go the way #1, then they can all use the same physical library).