Compiling Ogre 1.0.2 using Code::Blocks and VC7.1 Toolkit

Problems building or running the engine, queries about how to use features etc.
Post Reply
CrimsonShadow
Gnoblar
Posts: 23
Joined: Sat May 28, 2005 7:40 pm

Compiling Ogre 1.0.2 using Code::Blocks and VC7.1 Toolkit

Post by CrimsonShadow »

Has anyone successfully done this?

I have been using Code::Blocks and MinGW for a little while and while it works fairly well the debugging didn't seem to work all that well in that I can't look at variables, etc. so I was going to try to use VC7.1 Toolkit with the Code::Blocks IDE.

After downloading 1.0.2 and extracting it and downloading the VC7.1 dependencies and extracting them (and making some changes to files so they work better with OgreODE as detailed in the wiki) I tried to compile the various projects. The VC7.1 solution seems to import ok although it gives a bunch of file location warnings and everything seems to compile in OgreMain but when I get to linking it doesn't seem to work...

When I try to like it gives me a whole bunch of LNK2005 errors complaining that things are defined in both MSVCRT.lib and LIBC.lib.

For example,

Code: Select all

MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBC.lib(malloc.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _calloc already defined in LIBC.lib(calloc.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: __stricmp already defined in LIBC.lib(stricmp.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: __errno already defined in LIBC.lib(mterrno.obj)
Here's the command Code::Blocks is using to link:

Code: Select all

Project   : OgreMain
Compiler  : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\Projects\Programming\Ogre\ogrenew\OgreMain\scripts\
--------------------------------------------------------------------------------
link.exe /dll /nologo   /LIBPATH:..\..\Dependencies\lib\Release  /LIBPATH:"C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib" /LIBPATH:"C:\Program Files\Microsoft SDK\lib" /LIBPATH:C:\Projects\Programming\Ogre\ogrenew\Dependencies\lib\Release /LIBPATH:C:\Projects\Programming\Ogre\ogrenew\Dependencies\lib\Debug /out:..\lib\Release\ogremain.dll   kernel32.lib user32.lib zziplib.lib zdll.lib freetype219MT.lib devil.lib  ..\obj\Release\src\OgreAnimation.obj ..\obj\Release\src\OgreAnimationState.obj ..\obj\Release\src\OgreAnimationTrack.obj ..\obj\Release\src\OgreArchiveManager.obj ..\obj\Release\src\OgreAutoParamDataSource.obj ..\obj\Release\src\OgreAxisAlignedBox.obj ..\obj\Release\src\OgreBillboard.obj ..\obj\Release\src\OgreBillboardParticleRenderer.obj ..\obj\Release\src\OgreBillboardSet.obj ..\obj\Release\src\OgreBitwise.obj ..\obj\Release\src\OgreBone.obj ..\obj\Release\src\OgreBorderPanelOverlayElement.obj ..\obj\Release\src\OgreCamera.obj ..\obj\Release\src\OgreCodec.obj ..\obj\Release\src\OgreColourValue.obj ..\obj\Release\src\OgreCommon.obj ..\obj\Release\src\OgreConfigFile.obj ..\obj\Release\src\OgreConfigOptionMap.obj ..\obj\Release\src\OgreController.obj ..\obj\Release\src\OgreControllerManager.obj ..\obj\Release\src\OgreCursor.obj ..\obj\Release\src\OgreDataStream.obj ..\obj\Release\src\OgreDefaultHardwareBufferManager.obj ..\obj\Release\src\OgreDynLib.obj ..\obj\Release\src\OgreDynLibManager.obj ..\obj\Release\src\OgreEdgeListBuilder.obj ..\obj\Release\src\OgreEntity.obj ..\obj\Release\src\OgreEventDispatcher.obj ..\obj\Release\src\OgreEventProcessor.obj ..\obj\Release\src\OgreEventQueue.obj ..\obj\Release\src\OgreException.obj ..\obj\Release\src\OgreExternalTextureSource.obj ..\obj\Release\src\OgreExternalTextureSourceManager.obj ..\obj\Release\src\OgreFileSystem.obj ..\obj\Release\src\OgreFont.obj ..\obj\Release\src\OgreFontManager.obj ..\obj\Release\src\OgreFrustum.obj ..\obj\Release\src\OgreGpuProgram.obj ..\obj\Release\src\OgreGpuProgramManager.obj ..\obj\Release\src\OgreGpuProgramUsage.obj ..\obj\Release\src\OgreHardwareBufferManager.obj ..\obj\Release\src\OgreHardwareIndexBuffer.obj ..\obj\Release\src\OgreHardwareOcclusionQuery.obj ..\obj\Release\src\OgreHardwarePixelBuffer.obj ..\obj\Release\src\OgreHardwareVertexBuffer.obj ..\obj\Release\src\OgreHighLevelGpuProgram.obj ..\obj\Release\src\OgreHighLevelGpuProgramManager.obj ..\obj\Release\src\OgreILCodecs.obj ..\obj\Release\src\OgreILImageCodec.obj ..\obj\Release\src\OgreILUtil.obj ..\obj\Release\src\OgreImage.obj ..\obj\Release\src\OgreInput.obj ..\obj\Release\src\OgreInputEvent.obj ..\obj\Release\src\OgreKeyEvent.obj ..\obj\Release\src\OgreKeyFrame.obj ..\obj\Release\src\OgreKeyTarget.obj ..\obj\Release\src\OgreLight.obj ..\obj\Release\src\OgreLog.obj ..\obj\Release\src\OgreLogManager.obj ..\obj\Release\src\OgreMaterial.obj ..\obj\Release\src\OgreMaterialManager.obj ..\obj\Release\src\OgreMaterialSerializer.obj ..\obj\Release\src\OgreMath.obj ..\obj\Release\src\OgreMatrix3.obj ..\obj\Release\src\OgreMatrix4.obj ..\obj\Release\src\OgreMemoryManager.obj ..\obj\Release\src\OgreMesh.obj ..\obj\Release\src\OgreMeshManager.obj ..\obj\Release\src\OgreMeshSerializer.obj ..\obj\Release\src\OgreMeshSerializerImpl.obj ..\obj\Release\src\OgreMouseEvent.obj ..\obj\Release\src\OgreMouseMotionTarget.obj ..\obj\Release\src\OgreMouseTarget.obj ..\obj\Release\src\OgreMovableObject.obj ..\obj\Release\src\OgreMovablePlane.obj ..\obj\Release\src\OgreNode.obj ..\obj\Release\src\OgreOverlay.obj ..\obj\Release\src\OgreOverlayContainer.obj ..\obj\Release\src\OgreOverlayElement.obj ..\obj\Release\src\OgreOverlayElementCommands.obj ..\obj\Release\src\OgreOverlayManager.obj ..\obj\Release\src\OgrePanelOverlayElement.obj ..\obj\Release\src\OgreParticle.obj ..\obj\Release\src\OgreParticleEmitter.obj ..\obj\Release\src\OgreParticleEmitterCommands.obj ..\obj\Release\src\OgreParticleIterator.obj ..\obj\Release\src\OgreParticleSystem.obj ..\obj\Release\src\OgreParticleSystemManager.obj ..\obj\Release\src\OgrePass.obj ..\obj\Release\src\OgrePatchMesh.obj ..\obj\Release\src\OgrePatchSurface.obj ..\obj\Release\src\OgrePixelFormat.obj ..\obj\Release\src\OgrePlane.obj ..\obj\Release\src\OgrePlatformManager.obj ..\obj\Release\src\OgrePrecompiledHeaders.obj ..\obj\Release\src\OgrePredefinedControllers.obj ..\obj\Release\src\OgreProfiler.obj ..\obj\Release\src\OgreProgressiveMesh.obj ..\obj\Release\src\OgreQuaternion.obj ..\obj\Release\src\OgreRectangle2D.obj ..\obj\Release\src\OgreRenderQueue.obj ..\obj\Release\src\OgreRenderQueueSortingGrouping.obj ..\obj\Release\src\OgreRenderSystem.obj ..\obj\Release\src\OgreRenderSystemCapabilities.obj ..\obj\Release\src\OgreRenderTarget.obj ..\obj\Release\src\OgreRenderTexture.obj ..\obj\Release\src\OgreRenderWindow.obj ..\obj\Release\src\OgreResource.obj ..\obj\Release\src\OgreResourceBackgroundQueue.obj ..\obj\Release\src\OgreResourceGroupManager.obj ..\obj\Release\src\OgreResourceManager.obj ..\obj\Release\src\OgreRoot.obj ..\obj\Release\src\OgreRotationSpline.obj ..\obj\Release\src\OgreSceneManager.obj ..\obj\Release\src\OgreSceneManagerEnumerator.obj ..\obj\Release\src\OgreSceneNode.obj ..\obj\Release\src\OgreSceneQuery.obj ..\obj\Release\src\OgreSerializer.obj ..\obj\Release\src\OgreShadowCaster.obj ..\obj\Release\src\OgreShadowVolumeExtrudeProgram.obj ..\obj\Release\src\OgreSimpleRenderable.obj ..\obj\Release\src\OgreSimpleSpline.obj ..\obj\Release\src\OgreSingleton.obj ..\obj\Release\src\OgreSkeleton.obj ..\obj\Release\src\OgreSkeletonInstance.obj ..\obj\Release\src\OgreSkeletonManager.obj ..\obj\Release\src\OgreSkeletonSerializer.obj ..\obj\Release\src\OgreStaticGeometry.obj ..\obj\Release\src\OgreString.obj ..\obj\Release\src\OgreStringConverter.obj ..\obj\Release\src\OgreStringInterface.obj ..\obj\Release\src\OgreStringVector.obj ..\obj\Release\src\OgreSubEntity.obj ..\obj\Release\src\OgreSubMesh.obj ..\obj\Release\src\OgreTagPoint.obj ..\obj\Release\src\OgreTechnique.obj ..\obj\Release\src\OgreTextAreaOverlayElement.obj ..\obj\Release\src\OgreTexture.obj ..\obj\Release\src\OgreTextureManager.obj ..\obj\Release\src\OgreTextureUnitState.obj ..\obj\Release\src\OgreTimer.obj ..\obj\Release\src\OgreUserDefinedObject.obj ..\obj\Release\src\OgreVector2.obj ..\obj\Release\src\OgreVector3.obj ..\obj\Release\src\OgreVertexIndexData.obj ..\obj\Release\src\OgreViewport.obj ..\obj\Release\src\OgreWireBoundingBox.obj ..\obj\Release\src\OgreZip.obj    /nologo /incremental 
I've tried messing around with /NODEFAULTLIB:LIBC and LIBCMT, MSVCRT, etc. but I can't seem to get it to work. It usually just gives me different errors where it can't find symbols like __imp__strdup.

Probably just a stupid error on my part forgetting to do something but anyways... if anyone's gotten this to work and can point me in the right direction I'd appreciate it.

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

Post by RCRuiz »

CrimsonShadow
Gnoblar
Posts: 23
Joined: Sat May 28, 2005 7:40 pm

Post by CrimsonShadow »

RCRuiz wrote:I'm sure this will help

http://www.ogre3d.org/phpBB2/viewtopic. ... codeblocks

Un Saludo
Unfortunately it doesn't because it's using the Ogre SDK instead of compiling it from source. I can't use the SDK because I'm using OgreODE as well and I need to modify the source to get it to work completely with OgreODE.

That being said the errors I'm having are before modifying the source so it's not a case of me mucking with it. I also tried again last night with a fresh install of Code::Blocks, Ogre 1.0.2 for windows and the Ogre 7.1 dependencies and I get the same problems.

I'm at work no and I'll try later with the full Visual Studio C++ 2003 to see what linker commands it uses and hopefully I can get the Code::Blocks commands to match...

Thanks for the response though,
-CrimsonShadow
CrimsonShadow
Gnoblar
Posts: 23
Joined: Sat May 28, 2005 7:40 pm

Post by CrimsonShadow »

Well I messed around with this a bunch more and found out I still had Visual C++ 5 installed on my system and it was using the wrong libraries, etc.

I removed Visual C++ 5.0 and got the .NET SDK 1.1 (for msvcrt.lib) and after adding "/NODEFAULTLIB:LIBC" to the release version it builds...

But the debug version doesn't build because it apparently requires libcpmtd.lib which isn't included in VC7.1 toolkit or any of the other free downloads.. sigh.

So basically I'm giving up on using Code::Blocks with the VC7.1 toolkit... lol.


-CrimsonShadow
ricesteam
Gnoblar
Posts: 14
Joined: Mon Mar 28, 2005 7:12 pm

Post by ricesteam »

Ok, so I tried to follow the tutorial on how to install and configure ogre3d....but its outdated or something. It tells me to go to this directory to find this file, but THEY DON'T EXIST.

I downloaded code::blocks 1.0, Visual C++ Toolkit 2003, Windows Platform SDK, OGRE SDK for Visual C++ .Net 2003.

Installed all those, tried to go and build OGRE, but couldn't find the main project or what not or anything that resembles an openable project for me to compile. So I assumed I downloaded a prebuilt ogre.

I downloaded STLPort and installed that and did an nmake for visual c++ for .net.

Pointed to all the linkers and compiler directores: ie, Directx 9 SDK, ogre, STL port.

After 3 hours of fiddling with my computer and reading the forums here, I'm stuck. Very frustrating...why is it so hard to learn Ogre3d??? I haven't even gotten to the programming part.
User avatar
discipline
OGRE Community Helper
OGRE Community Helper
Posts: 766
Joined: Mon May 16, 2005 12:09 am

Post by discipline »

@ricesteam, if you downloaded the SDK, then you are never going to find a project file to build ogre. The sdk is precompiled. You also don't need the STL port. The codeblocks wiki is accurate.

@crimsonshadow: I spent all last week trying to build ogre with codeblocks and the toolkit. I got it to produce DLLs, but they don't work. My recommendation: DON'T. Or buy msvc or use codeblocks with gcc.

The codeblocks+msvc solution works great with the precompiled SDK. Don't try to compile ogre with it until you have experience and patience to figure it out as the first person doing it.

http://www.ogre3d.org/phpBB2/viewtopic. ... highlight=
ricesteam
Gnoblar
Posts: 14
Joined: Mon Mar 28, 2005 7:12 pm

Post by ricesteam »

Thanks.

Tried what the other folks have tried, (I even tried to download the source and compile it which lead to more problems...)

I'm back with my original setup, using the prebuilt OGRE SDK still getting these errors when I try to compile and run a simple OGRE application:

Code: Select all

Switching to target: Release
Linking console executable: Release\ogre_sample.exe
LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in LIBC.lib(dosmap.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
User avatar
discipline
OGRE Community Helper
OGRE Community Helper
Posts: 766
Joined: Mon May 16, 2005 12:09 am

Post by discipline »

ricesteam
Gnoblar
Posts: 14
Joined: Mon Mar 28, 2005 7:12 pm

Post by ricesteam »

Still no luck....

Multithreaded DLL enabled for both release and debug modes....

I'm reading all these solutions and how other people solved it, i try to follow their steps exactly, but nothing is working.

I don't understand.

Maybe it's the code (taken directly from the wiki tutorials)

Code: Select all

#include "Ogre.h"
#include "ExampleApplication.h"
#include <windows.h>
// First, we declare a subclass of the ExampleApplication class
class FirstApp : public ExampleApplication
{
public:
   FirstApp() { }
   

   /** createScene is pure virtual in ExampleApplication, so we just override it to do nothing.
    *  What this means is that we'll be creating an empty scene at first.
    **/
   void createScene(void) { }
};


INT WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,INT) {
   FirstApp myApp;     // Instanciate our subclass
   try {           // This try-catch provides a nice way of popping up errors if they occur.
       myApp.go(); // ExampleApplication provides a go method, which starts the rendering.
   } catch (Ogre::Exception& e) {
       MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!",
           MB_OK | MB_ICONERROR | MB_TASKMODAL);
   }
   return 0;
}
User avatar
discipline
OGRE Community Helper
OGRE Community Helper
Posts: 766
Joined: Mon May 16, 2005 12:09 am

Post by discipline »

Code looks fine. Your problem is linking. Define still not working. If you changed compiling modes you should have gotten a different error message. I saw you installed STL port. You do not need STL port, and it may be messing you up. Get rid of it and remove the directories from codeblocks. Following the codeblocks instructions in the wiki works perfectly.

http://www.ogre3d.org/wiki/index.php/Codeblocks
why is it so hard to learn Ogre3d??? I haven't even gotten to the programming part.
This isn't Ogre. This is learning how to use your compiler and linker.
ricesteam
Gnoblar
Posts: 14
Joined: Mon Mar 28, 2005 7:12 pm

Post by ricesteam »

Thanks.....

But by taking out STLPort, I'm back to my original problem:

Code: Select all

fatal error C1083: Cannot open include file: 'hash_set': No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
User avatar
discipline
OGRE Community Helper
OGRE Community Helper
Posts: 766
Joined: Mon May 16, 2005 12:09 am

Post by discipline »

Please start over and follow the above link step by step. It works. I just updated it with some directories that should have been included. Here's a clue, if your compiler says it can't find a file, search your harddrive for it. When you find a directory with it in there, you might try including that to your compiler or linkers search path. Hash_set is in the toolkit include directory.
Post Reply