Successful CodeBlocks + VC++ Toolkit use with Ogre

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
ionstream
Gnoblar
Posts: 15
Joined: Tue Mar 22, 2005 1:22 am

Successful CodeBlocks + VC++ Toolkit use with Ogre

Post by ionstream »

This is my first post in the Ogre world! Hopefully it's in the right forum, and has not been posted before. Here goes...


Being a cheapskate, I was looking around for free IDEs, and of course, found Dev-C++. It's pretty good, despite it's bugs, and worked... up until I wanted to use Ogre. There were know GCC Precompiled binaries (which is understandable, because there are many flavors of GCC), and the using GCC with Ogre tutorials were so complicated, that I might as well have just bought VC .NET (yes, I almost went there). Luckily, MS has released the Visual C++ 2003 toolkit (the free compilers), and IDE's were already in the making. One of these IDE's is CodeBlocks (http://www.codeblocks.org), of which I highly suggested donating to if you plan on using it. Setup for Ogre in Codeblocks is fairly simple, as I will explain here.

1: Download the VC++ Toolkit (http://msdn.microsoft.com/visualc/vctoolkit2003/). Install it.

2: Download the Platform SDK. You can either use IE to install automatically (recommended), or install using another browser.
IE: http://www.microsoft.com/msdownload/pla ... /sdkupdate
Other: http://www.microsoft.com/msdownload/pla ... k-full.htm

3: Navigate to the Platform SDK directory (Default "C:\Program Files\Microsoft SDK") and run SetEnv.bat. Restart your computer.

4: Download CodeBlocks (link above) and install it.

5: Run CodeBlocks. The first time you install it, you will be listed with a set of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default. Press OK.

6 Download the Ogre OGRE 1.0.0 SDK for Visual C++ .Net 2003 (7.1). This will work perfectly with the VC++ Toolkit!

7: Your .SLN or .VCPROJ files can be imported via Project->Import-> (File Type). Or, you can make a new Win32 GUI application (Project->New Project...)

8: To set the Ogre Directories, go to Project->Properties, and click the Target's tab. If there is more than one target in the "Targets" listbox (if you imported a VCPROJ or SLN), you can follow the steps, but do it for both targets. Select a target and click "Target's Build Options..."

Note: Make sure that the "Type" listbox is GUI Application. This is mandatory.

9: In the Compiler Options (first) tab, type "/EHsc" (without quotes) to the "More Options" box. This isn't mandatory, but it will prevent alot of warnings.

10: In the "Compiler Dirs" tab, add the Ogre3d Include directory. In the "Linker Dirs" tab, add the Ogre3D lib directory.

11: In the Linker Options tab, add OgreMain.lib to the link libraries. Note that you don't need the full path, just OgreMain.lib will suffice. You may need to add user32.lib and gdi32.lib to the libraries if you imported a project.

12: Press OK in all of the windows. Click the gear with the red arrow to compile and run your project. If all went well, you should be seeing the Ogre3D Engine Rendering Setup window!


Please reply to this post if you have any problems, I will be happy to answer any questions![/b]
To Game Development!

ionstream
Gnoblar
Posts: 15
Joined: Tue Mar 22, 2005 1:22 am

Post by ionstream »

Well, I've just realized that there is a Dev-c++ devpack, which makes installing Ogre on free IDE's much easier. Sorry for the waste of forum space... :( .
To Game Development!

User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
Contact:

Post by Clay »

lol No worries. Welcome to the community. =)

siddhartha
Gnoblar
Posts: 4
Joined: Wed Mar 30, 2005 2:54 am

Post by siddhartha »

The Dev C++ devpack installation is incompatible with CEGUI which is used in many of the tutorials, creating much frustration for the rest of us cheapskates. I was able to get CodeBlocks working with VC++ toolkit and am much happier with that IDE compiler combination even though I am a Dev C++ user at heart.
The more I learn...the less I know.

User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Why not use the Codeblocks+gcc combi like described here:

http://www.ogre3d.org/wiki/index.php/Th ... Blocks_IDE

It's quite simple, and you can use CEGUI with that.

SigfriedMcWild
Halfling
Posts: 62
Joined: Wed Mar 03, 2004 3:12 am
Location: just a figment of your imagination
Contact:

Post by SigfriedMcWild »

where can I find the code::blocks dependencies?

I've looked in the downloads section but havne't found it

User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »


SigfriedMcWild
Halfling
Posts: 62
Joined: Wed Mar 03, 2004 3:12 am
Location: just a figment of your imagination
Contact:

Post by SigfriedMcWild »

thanks

User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA
Contact:

Post by Goosey »

I like the post ionstream, it seems useful to get CodeBlocks working with the free VS compilers. Maybe wiki this up?
I <3 the OGRE Wiki, and SO SHOULD YOU! :)

User avatar
litobyte
Halfling
Posts: 64
Joined: Mon Mar 28, 2005 7:03 pm
Location: Somewhere in Italy
Contact:

Post by litobyte »

I wonder why do I have to accomplish point 2.

2: Download the Platform SDK. You can either use IE to install automatically (recommended), or install using another browser.

This seems to be windows2003 server platform SDK download.
Why would an ogre3D project under code::blocks needs that ?

Apologies for the ignorant question.

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 6
Contact:

Post by haffax »

Because Ogre uses the Win32-API to create the RenderWindow and the config dialog and such.
team-pantheon programmer
creators of Rastullahs Lockenpracht

User avatar
litobyte
Halfling
Posts: 64
Joined: Mon Mar 28, 2005 7:03 pm
Location: Somewhere in Italy
Contact:

Post by litobyte »

Yes ok, but I guess the required files are already there if you run already windows XP sp2 ?

Or this is required only to compile the full ogre engine ?

I'm using the precompiled ogre SDK to work /learn on my samples.
I guess this download isn't required to compile them.

I had downladed only: Visual C++ 2003 Toolkit, DX9 SDK (october), and all went fine with the OgreSDK.

User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

It is required for *compiling* Ogre, not for running or using it. It's an SDK, after all, it provides the interfaces to windows components.

User avatar
litobyte
Halfling
Posts: 64
Joined: Mon Mar 28, 2005 7:03 pm
Location: Somewhere in Italy
Contact:

Post by litobyte »

Hem, but I can access the windows API without to install the platform SDK.

And I compile all of the samples in the OgreSDK samples directory without to had the need to download&install PlatformSDK.

Also I use other programming languages that defines the call to Windows API element such as the HWND of an application, or the SetCursor method of the win API. I don't find the point and the use of the discussed download.

But as I understand, it's required only for the complete compile of the full Ogre 1.0.1 source distribution.

Still I don't understand why that's needed, when all the components and .dll are already installed on clients systems, so you just have to access them, and not to re-install them. I compiled other win32 engines without to download that package.

Do you mean that the package is intended for who wants to compile a win32 version of the engine under MacOSx or Linux ?

User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

The Windows SDK is the C/C++ headers and the import libraries. You need them to compile things that run against the Windows runtime, i.e. the DLLs that are already on your system. Just like you need the DirecTX SDK to compile programs that use the DirectX API, but you only need the DirectX Runtime libraries on your target PCs to run the compiled application.

User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

dlls are only usable by compiled programs and libraries. To build against them you need .lib files and accompanying headers (.h), which come with the SDK,

User avatar
litobyte
Halfling
Posts: 64
Joined: Mon Mar 28, 2005 7:03 pm
Location: Somewhere in Italy
Contact:

Post by litobyte »

I see, my experience with C++ full compiling applications is so limited...

Sorry for the ultranewb questions.

I only had the chance to make a lot of C++ compiles under Linux.
And well, I found that much easier than on windows platform.

What limitations are in using the ogreSDK precompiled version to write your own game engine/s ?

Thanks in advance.

User avatar
joshcryer
Gnome
Posts: 351
Joined: Wed Oct 13, 2004 8:22 am

Post by joshcryer »

Just FYI, I'll add the CEGUI stuff to the next Dev-C++ DevPak, you can steal the CodeBlocks dependencies and have CEGUI available (the lib and dll) if you don't want to wait. But you want to probably stay with CodeBlocks if you got that far, you know ya want to.

ionstream
Gnoblar
Posts: 15
Joined: Tue Mar 22, 2005 1:22 am

Post by ionstream »

Whoa, I haven't posted in a while.

Litobyte, if you used the Win32 API without the Platform SDK then I want to borrow some of your magic powers! :D

Yeah, I'll stick with CodeBlocks because I like the new-style look. Also, it's written in good ol fashion C++, no Delphi :).
To Game Development!

amccampos
Gnoblar
Posts: 2
Joined: Thu May 19, 2005 2:10 pm

cegui dev-c++ pack

Post by amccampos »

Just FYI, I'll add the CEGUI stuff to the next Dev-C++ DevPak
joshcryer, when do you plan to to that?
It'll be great!!!

RCRuiz
Kobold
Posts: 27
Joined: Mon Apr 11, 2005 1:11 am

Post by RCRuiz »

Hi to all!!

I'm a beginer on ogre and on c++ but I test dev-c, codeblocks with gcc and vc.6 using ogre.

In all of those ogre work greate but when you try to introduce openal on the program well . . . dev-c as it is right now it does not work, codeblocks with gcc it have a lot of wird stuff like if you use or init openal and then use any material with a texture on ogre it crash , by using open vc++.6 it work great ogre and openal but is not free. My last hope is this option using vs kid on codeblock and try to use Ogre with openal but following the instructions I have the next error

Code: Select all

Terrain.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function $L130531
..\..\bin\debug\demo_terrain.exe : fatal error LNK1120: 1 unresolved externals
Process terminated with status 1 (0 minutes, 0 seconds)
Can someone please help me solving it.

Thank you

User avatar
sboris
Gnoblar
Posts: 1
Joined: Sun Nov 24, 2002 2:23 pm

Post by sboris »

Your missing either advapi32.lib or user32.lib from list of additional dependencies libs in the linker settings.

Hope this helps

RCRuiz
Kobold
Posts: 27
Joined: Mon Apr 11, 2005 1:11 am

Post by RCRuiz »

Thanks for the reply but do not work

I put the user32.lib,the advapi32.lib and the gdi32.lib and now I have this

Code: Select all

Terrain.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
Terrain.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
win32gui.exe : fatal error LNK1120: 2 unresolved externals
Process terminated with status 1 (0 minutes, 0 seconds)
Any other idea?

Thank you

RCRuiz
Kobold
Posts: 27
Joined: Mon Apr 11, 2005 1:11 am

Post by RCRuiz »

GREAT !!! problem solve!!!

It seam that the setenv was not altering the enviroment so I modify the autoexec.bat and put it by hand and that's it.

I test Ogre + OpenAl on the Codeblock and visual studio kid and work great. so this is the best free and complete solution from my my point of view.

so Thank you ionstream

Saludos

ionstream
Gnoblar
Posts: 15
Joined: Tue Mar 22, 2005 1:22 am

Post by ionstream »

:) No problem, I'm glad someone benefited from this. And I'll see if I can Wiki-it (Wikit?).

I hope more people hear about CodeBlocks, it's so much better than Dev-C++! The only problem is that the CodeCompletion doesn't work with the Visual C++ Toolkit, but since Dev can't support that anyways, it's no big problem.
To Game Development!

Post Reply