Codeblocks + Mingw C++ Toolbox Windows

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Codeblocks + Mingw C++ Toolbox Windows

Post by calsmurf2904 »

Hello,
I used to use Visual C++ but since I am trying to create a windows and linux compatible version i thought maybe I should use the same compiler that linux uses (GCC).I also use Codeblocks in linux so the project file can be used in windows and linux.The main problem is that when I try to compile Ogre on windows with Codeblocks it doesn't work.
(Haven't tryed linux yet)
Here are the errors that I get (Some of them)

Code: Select all

C:/OgreWin1.6/ogre/OgreMain/src/OgreArchiveManager.cpp:131: undefined reference to `Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> >::operator delete(void*)'
..\obj\Debug\src\OgreArchiveManager.o: In function `ZN4Ogre14ArchiveManagerD1Ev':
C:/OgreWin1.6/ogre/OgreMain/src/OgreArchiveManager.cpp:131: undefined reference to `Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> >::operator delete(void*)'
..\obj\Debug\src\OgreArchiveManager.o: In function `ZN4Ogre14ArchiveManagerD0Ev':
C:/OgreWin1.6/ogre/OgreMain/src/OgreArchiveManager.cpp:131: undefined reference to `Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> >::operator delete(void*)'
..\obj\Debug\src\OgreAutoParamDataSource.o: In function `ZN4Ogre19AutoParamDataSourceD2Ev':
C:/OgreWin1.6/ogre/OgreMain/src/OgreAutoParamDataSource.cpp:89: undefined reference to `Ogre::AllocatedObject<Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)3> >::operator delete(void*)'
Process terminated with status 1 (0 minutes, 30 seconds)
50 errors, 0 warnings
All 50 errors are the same (Undefined Reference)
Does anyone knows what is causing this problem ?
mtest
Halfling
Posts: 85
Joined: Tue Jun 17, 2008 2:44 am
Location: United States

Post by mtest »

Not to say I know all the things that could do this, but make sure that you are, indeed, including everything. Make sure you have (at least, I'm guessing) the three entries under your Project->BuildOptions for the lib and includes, so Mr. Compiler can put everything together.

If your using the prebuilt SDK, you should also have the main Ogre Path in a system variable to be used with the createproject thing.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Post by calsmurf2904 »

mmm...yes i have and I am building the source of 1.6RC1
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Post by calsmurf2904 »

ok...finally got OgreMain to compile.
However I can't do anything since I can't compile the render systems because it still gives that error.
Does anyone knows how to fix this ?
mccleive
Gnoblar
Posts: 4
Joined: Tue Oct 21, 2008 11:39 pm

Post by mccleive »

I'm having the same errors that you listed -- what did you change to fix it?
xmt
Gnoblar
Posts: 23
Joined: Sat Oct 04, 2008 5:08 pm
Location: Bristol Uni, UK

Post by xmt »

i assume you are trying to compile 1.6RC1. if you are, get the latest 1.6 from svn instead which has an updated codeblocks workspace. the workspace in 1.6RC1 is missing several files which are suposed to have been included. you might have to play around with adding a few other files too.

i had the same set of issues, take a look at these two posts in my topic for more info:
http://www.ogre3d.org/phpBB2/viewtopic. ... 851#308826
http://www.ogre3d.org/phpBB2/viewtopic. ... 851#310880
mccleive
Gnoblar
Posts: 4
Joined: Tue Oct 21, 2008 11:39 pm

Post by mccleive »

Thanks for the tip! Here's the full info in case someone else comes along:

These errors were from using the release Ogre 1.6.0 RC1 for Windows, like you suspected.

Now I'm using:
+ Code::Blocks 8.02
+ MinGW Toolbox
+ Ogre Source from SVN (branch v1-6)
+ Code::Blocks + MinGW C++ Toolkit Precompiled Dependencies (20080115)
+ DirectX August 2008

OgreMain compiled successfully! I still have the same DirectX related error that others are having but I can stick with OpenGL, so that's not a major issue for me.

Now I just need to convert an old program that was written for Ogre 1.2.x. Lots of changes since then....
xmt
Gnoblar
Posts: 23
Joined: Sat Oct 04, 2008 5:08 pm
Location: Bristol Uni, UK

Post by xmt »

glad i could help.

just to clarify, here's a list of the issues i've (we've?) encountered with codeblocks and the 1.6 svn (using rev 8111 at time of posting):

1) RenderSystem_GL doesn't build as is due to a linker error

the full error can be seen at the bottom of this post: http://www.ogre3d.org/phpBB2/viewtopic. ... 851#308699

the fix is to add OgreGLRenderToVertexBuffer.cpp (found in \RenderSystems\GL\src) to the rendersystem's project, not by adding OgreRenderToVertexBuffer.cpp to the OgreMain project as sinbad suggested in reply to the post i just linked. different file to a different project, although the filenames are almost identical.

2) RenderSystem_Direct3D9 doesn't build, and i don't know how to fix it.

it gives compiler errors relating to hashmaps, i can't make any sense of it. the full error can be seen in this post: http://www.ogre3d.org/phpBB2/viewtopic. ... 851#309047

more info and temporary work arounds: http://www.ogre3d.org/phpBB2/viewtopic. ... 851#310957

----

anything else people have been running into?

codeblocks doesn't seem to be getting much love from the ogre devs atm :cry:. i can supply codeblocks workspace and project files that fix issue #1 above if that'd help. i think these issues should be logged as an official bug against 1.6

cheers,
Mark
xmt
Gnoblar
Posts: 23
Joined: Sat Oct 04, 2008 5:08 pm
Location: Bristol Uni, UK

Post by xmt »

found something interesting relating to the mingw hashmap error when digging through some old topics:

http://www.ogre3d.org/phpBB2/viewtopic. ... 359#223359

seems to me like the same issue, just with a different file/function. unfortunately i'm not sure how it was resolved, or even if it was, anyway i thought the info might be useful to someone.

Mark
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

This problem is fixed in v1-6 as of today.
ipons
Gnoblar
Posts: 4
Joined: Thu Feb 22, 2007 11:00 pm
Location: Toronto
Contact:

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by ipons »

Hello,

As per today svn revision 8244 on e v1-6, I had linking error unable to resolve:
_InterlockedExchange(LONG volatile *Target, LONG Value) on malloc.c.h.

Apparently the memory allocator had been switched to nedmalloc. To whom use MinGW can switch back
to STD allocator, or if you want to continue with nedmalloc, you can modify malloc.c.h by adding

Code: Select all

#ifdef __MINGW32__
#define interlockedcompareexchange InterlockedCompareExchange
#define interlockedexchange InterlockedExchange
#endif /* __MINGW32__ */
right after

Code: Select all

#endif /* Win32 */
And you have to update MinGW API to newer version (I use w32api-3.12). I found the old API has wrong argument parameters on those two functions.

I hope that helps.

Ipon Supriyono
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by sinbad »

Thanks, that definitely helps our C::B users. I'll get the change committed.
poulpi33
Gnoblar
Posts: 1
Joined: Fri Jan 23, 2009 11:51 pm

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by poulpi33 »

Hello,

I've downloaded the latest svn revision 8278 1.6 branch, wich have the __MINGW32__ fix in malloc.c.h, but have errors:

Code: Select all

../src/nedmalloc/malloc.c.h: In function `int win32_acquire_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1783: error: invalid conversion from `volatile long int*' to `long int*'
Compiling: ..\src\OgreParticle.cpp
../src/nedmalloc/malloc.c.h:1783: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
../src/nedmalloc/malloc.c.h: In function `void win32_release_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1801: error: invalid conversion from `volatile long int*' to `long int*'
../src/nedmalloc/malloc.c.h:1801: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
../src/nedmalloc/malloc.c.h: In function `int win32_try_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1813: error: invalid conversion from `volatile long int*' to `long int*'
../src/nedmalloc/malloc.c.h:1813: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
[EDIT]
I did download the latest mingw with the w32api-3.12 (latest code::block have 3.11), but forget to install it :oops:
Now it's working.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by jacmoe »

Whew.. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Skatt
Gnoblar
Posts: 13
Joined: Thu Nov 11, 2010 10:22 am
x 1

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by Skatt »

poulpi33 wrote:Hello,

I've downloaded the latest svn revision 8278 1.6 branch, wich have the __MINGW32__ fix in malloc.c.h, but have errors:

Code: Select all

../src/nedmalloc/malloc.c.h: In function `int win32_acquire_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1783: error: invalid conversion from `volatile long int*' to `long int*'
Compiling: ..\src\OgreParticle.cpp
../src/nedmalloc/malloc.c.h:1783: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
../src/nedmalloc/malloc.c.h: In function `void win32_release_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1801: error: invalid conversion from `volatile long int*' to `long int*'
../src/nedmalloc/malloc.c.h:1801: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
../src/nedmalloc/malloc.c.h: In function `int win32_try_lock(win32_mlock_t*)':
../src/nedmalloc/malloc.c.h:1813: error: invalid conversion from `volatile long int*' to `long int*'
../src/nedmalloc/malloc.c.h:1813: error:   initializing argument 1 of `LONG InterlockedExchange(long int*, LONG)'
[EDIT]
I did download the latest mingw with the w32api-3.12 (latest code::block have 3.11), but forget to install it :oops:
Now it's working.
I am getting this same set of errors. I have the MinGW toolkit now(For those that have seen my previous posts where I was using the TDM download.) It is installed and I have it defined in PATH. I have made sure that both cMake and Code::Blocks are using the right version of g++. I'm not sure what other things I can check.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: Codeblocks + Mingw C++ Toolbox Windows

Post by CABAListic »

Don't use the toolkit, it's outdated. Either use TDM or the official MinGW distribution; you need a GCC version >= 4.x
Post Reply