Skip to main content

History: Setting Up An Application - CodeBlocks

Source of version: 2

Copy to clipboard
            {maketoc}

!!!~np~Code::Blocks & MinGW 3.4.5 & STLPort 5.0~/np~
Have a look at the build options for Demo_CameraTrack, most of the demos use the same build options.

__Note:__ with MinGW gcc 3.4.5 you can link directly against dll's built by gcc 3.4.5 and do not require an import lib. This is the same setup on Linux where you link directly to the shared object (.so). This is why the SDK does not come with import libs for Ogre. You don't need them.

{TAG(tag="u")}Build options that you should use:{TAG}

Normally you will have two targets: __Debug__ and __Release__.

To create a new target:
# Right click on the project in the Management window and select Properties in the popup and this will open up the properties window for your project.
# Select the Target tab.
# Select Add to define a new target.
# Type in the target name ie Debug.
# Select OK.

Select Build Options to modify build options for a target.

!!!!Project build options
will be used for both Debug and Release target build options:

{img src="img/wiki_up/CB_PCOS.jpg" alt="CB_PCOS.jpg"}

ensure Selected compiler is: GNU GCC Compiler
* Compiler
** Other options
*** -mthreads
*** -fmessage-length=0
*** -fexceptions
*** -fident
** '#defines'
*** _STLP_NO_CUSTOM_IO
 If your app does not define any custom IO templates then this define will speed up compiles.
*** _STLP_USE_DYNAMIC_LIB
this ensures that the DLL version of STLPort is used.
* Linker
** Other linker options:
*** -Wl,--enable-auto-image-base
*** -Wl,--add-stdcall-alias
* Directories
** Compiler
*** ~np~$(OGRE_HOME)\stlport\stlport~/np~
__VERY IMPORTANT:__ The stlport include directory has to be first in the include directories. If it is not then headers used for libstdc++ could get included which will cause conflicts with stlport during the link stage. You will most likely get undefined reference error messages with member methods saying they require std::string (method parameters). You should never see std:: in an error message and if you do then it means that the STLPort headers were not found and libstdc++ headers were used instead. If you do end up in this scenerio, after you correct the directory problem you must do a rebuild so that everything gets recompiled with the proper headers. Selecting build won't do it since CB will just attempt to do the link stage again since it doesn't detect any changes in the source and will fail again.
*** $(OGRE_HOME)\include
*** Your project include directories
** Linker
*** $(OGRE_HOME)\bin\$(TARGET_NAME)
this is the path to OgreMain.dll or OgreMain_d.dll along with [http://stlport.5.0.dll|stlport.5.0.dll] or [http://stlportstlg.5.0.dll|stlportstlg.5.0.dll] depending on TARGET_NAME state. $(TARGET_NAME) is a built in {CODE(wrap="1")}Code::Blocks{CODE} macro that you can use in your project settings. It gives you the active project target build name.

!!!!Debug build target options:
{img src="img/wiki_up/CB_DTOS.jpg" alt="CB_DTOS.jpg"}

ensure Selected compiler is: GNU GCC Compiler
set Policy to 'Append target options to project options'
* Compiler
** '#defines'
*** WIN32
*** _DEBUG
*** _WINDOWS
*** _STLP_DEBUG
this tells STLPort to use the special debug build version of the dll
* Linker
** Link libraries:
*** Your project dll's or static libs (.a)
*** OgreMain_d
this is the name of the debug build of OgreMain dll.
*** stlportstlg.5.0
this must be the last entry

!!!!Release build target options:
ensure Selected compiler is: GNU GCC Compiler
set Policy to 'Append target options to project options'
* Compiler
** '#defines'
*** WIN32
*** NDEBUG
*** _WINDOWS
* Linker
** Link libraries:
*** Your project dll's or static libs (.a)
*** OgreMain
this is the name of the release build of OgreMain dll.
*** stlport.5.0
this must be the last entry

__Note:__ OGRE_HOME is a pre-defined environment variable setup by the SDK installer. OGRE_HOME points to the directory where the SDK is installed. You can use ~np~$(OGRE_HOME)~/np~ within your build options when setting up paths to specific directories with the SDK that you will need to access.

__WARNING__ Do not mix dll and static object builds using different STL implementations. Here is an example: You build a dll using stdlibc++ but your exe is built using STLPort. Everything that is c++ must be built using STLPort. This does not apply to C static libs and dll's.

---
{INCLUDE(page="Setting Up An Application - First Application")}{INCLUDE}
{img fileId="1641" thumb="y" alt="" rel="box[g]"}  
        

History

Information Version
Sat 08 of Aug, 2015 17:36 GMT-0000 spacegaier fixed broken link 76
Mon 04 of Mar, 2013 08:21 GMT-0000 TheSHEEEP 75
Mon 04 of Mar, 2013 08:19 GMT-0000 TheSHEEEP Added more clear filename explanation. 74
Thu 13 of Dec, 2012 16:37 GMT-0000 Flateno Added a hint to include linker lib path for boost 73
Wed 07 of Nov, 2012 08:39 GMT-0000 TheSHEEEP 72
Wed 07 of Nov, 2012 08:36 GMT-0000 TheSHEEEP 71
Wed 07 of Nov, 2012 08:35 GMT-0000 TheSHEEEP 70
Wed 07 of Nov, 2012 08:35 GMT-0000 TheSHEEEP 69
Wed 07 of Nov, 2012 08:35 GMT-0000 TheSHEEEP Added info for boost 68
Wed 07 of Nov, 2012 08:28 GMT-0000 TheSHEEEP Added some help to prevent MinGW GCC version confusion. 67
Wed 07 of Nov, 2012 08:26 GMT-0000 TheSHEEEP 66
Fri 08 of Jun, 2012 03:47 GMT-0000 jacmoe 65
Fri 25 of May, 2012 23:56 GMT-0000 jacmoe Boost version is no longer part of directory name 64
Sun 28 of Aug, 2011 00:56 GMT-0000 jacmoe 63
Wed 09 of Feb, 2011 02:34 GMT-0000 Lexi changed boost link to 1_44 and under Release defines corrected tab title from Debug ... to Release ... Copy Paste issue i think 62
Sun 26 of Dec, 2010 16:34 GMT-0000 grimfang4 Added specific mention of resources.cfg and plugins.cfg, since they're what I additionally needed when I followed these directions. 61
Sun 19 of Dec, 2010 20:58 GMT-0000 calipe OGRE 1.7.2 requires the latest MinGW distribution. The old version of this article instructed the users to download the TDM MinGW suit which installs MinGW 4.4.1; this leads to linking errors when com 60
Fri 27 of Aug, 2010 02:04 GMT-0000 UnknownDevice Changed link from nightly build to main binaries as they been updated to 10.05 as of 27 May 2010 59
Tue 03 of Aug, 2010 13:16 GMT-0000 enclave 58
Tue 03 of Aug, 2010 12:28 GMT-0000 enclave Changed search directories: $(OGRE_HOME)\include\boost_1_42 -> $(OGRE_HOME)\boost_1_42. Because this path doesn't exists and causes compilation errors. 57
Thu 27 of May, 2010 14:17 GMT-0000 jacmoe 56
Thu 27 of May, 2010 14:16 GMT-0000 jacmoe 55
Thu 27 of May, 2010 14:16 GMT-0000 jacmoe 54
Sun 23 of May, 2010 00:08 GMT-0000 jacmoe 53
Sun 23 of May, 2010 00:08 GMT-0000 jacmoe 52