OgreNewt and Code::Blocks

nihilocrat

19-05-2006 21:50:41

I've been somewhat successful using Code::Blocks (nightly build, as per the ogre SDK instructions) to build OgreNewt. I had to fiddle with some things but I was able to compile static and dll libraries, but they don't seem to be working. This is the first time I've had to build a library myself in Windows to use in another project, so I might just be making stupid mistakes. I have the proper directories included for both compiler and linker, and I'm pretty sure I have everything for the linker setup fine. However, I get these errors (only from ld, not from gcc, so compilation apparently went fine), so I presume some library isn't getting loaded.


Linking executable: Demo01_TheBasics_vc71.exe
Build\Debug\OgreNewtonFrameListener.o:OgreNewtonFrameListener.cpp:(.text+0x83a): undefined reference to `Ogre::StringConverter::toString(int, unsigned short, char, std::_Ios_Fmtflags)'
Build\Debug\OgreNewtonFrameListener.o:OgreNewtonFrameListener.cpp:(.text+0xafa): undefined reference to `Ogre::Entity::setMaterialName(std::string const&)'

.. etc ..

..\..\OgreNewt_Main\lib\debug/libOgreNewt_Main_d.a(OgreNewt_BasicFrameListener.o):OgreNewt_BasicFrameListener.cpp:(.text+0x874): undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
..\..\OgreNewt_Main\lib\debug/libOgreNewt_Main_d.a(OgreNewt_Debugger.o):OgreNewt_Debugger.cpp:(.text+0x35b): undefined reference to `Ogre::ManualObject::ManualObject(std::string const&)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)


If anyone wants to look further into it, I can provide the code::blocks workspace and project files I'm using.

nihilocrat

25-05-2006 21:57:04

Okay... maybe I should rephrase this...

Has anyone gotten OgreNewt to work using MingW32 with any IDE?

It's really bothering me because Newton seems like a good, simple engine for what I want and I need to get a physics engine of some sort going before I can move on with my game.

mysterycoder

25-05-2006 23:54:58

I've got it working, did you check the project options on the demo and make sure they are pointing to the right folder?

Also, are you using the prebuilt SDK or the source?

nihilocrat

30-05-2006 01:23:16

I'm using OgreNewt from source (the download on the site, not from CVS) and using the prebuilt Newton SDK. I don't think Newton even has a source version. I think all of my directories are fine. I've been able to get the library itself to compile both statically and into a DLL but I can't seem to compile the demos with those due to the linker errors above.

I'll post the project file I'm using once I get to the machine I was trying this out on...

mysterycoder

30-05-2006 04:40:53

I mean the Ogre SDK or source :oops:

That'd be great if you post the project files, I'll be glad to check them out.

nihilocrat

02-06-2006 17:14:17

I've been using the Ogre SDK.

I was actually able to get everything to link properly when I switched over to using the static lib. I had to also link newton's static lib, but at least it seems to work for the time being. I'm going to try running through one of the tutorials to see if it will end up being okay.

Are there any special considerations to take when compiling and using the DLL version?

edit:
Now I'm getting these errors. What I've done is try to use the code from the wiki tutorial. I've removed any repeats.


lib\OgreNewt_Main.lib(OgreNewt_BasicFrameListener.o):OgreNewt_BasicFrameListener.cpp:(.text+0x6e3): undefined reference to `Ogre::StringConverter::toString(float, unsigned short, unsigned short, char, std::_Ios_Fmtflags)'
lib\OgreNewt_Main.lib(OgreNewt_BasicFrameListener.o):OgreNewt_BasicFrameListener.cpp:(.text+0x7ed): undefined reference to `Ogre::LogManager::logMessage(std::string const&, Ogre::LogMessageLevel, bool)'
lib\OgreNewt_Main.lib(OgreNewt_BasicFrameListener.o):OgreNewt_BasicFrameListener.cpp:(.text+0x113d): undefined reference to `Ogre::OverlayManager::getByName(std::string const&)'
lib\OgreNewt_Main.lib(OgreNewt_Debugger.o):OgreNewt_Debugger.cpp:(.text+0x51c): undefined reference to `Ogre::ManualObject::ManualObject(std::string const&)'


These are the libs that I'm telling the linker to link with: OgreMain, stlport.5.0, CEGUI_Base, OgreGUIRenderer, OgreNewt_Main, Newton

I'm trying to compile for release, so I don't really have interest in the debugger. I have a "debug-lite" target which only produces debugging symbols for my own code, and that seems to be enough when the odd null pointer causes a segfault.

Edit 2 :
It might be useful to point out that these linker errors occur only when I try to enable the BasicFrameListener. If I just create a World and define Bodies, everything works well, but it's sort of useless without a framelistener :P

tnguyen

06-06-2006 03:34:46

It looks like you're not using stlport as your STL library.

mysterycoder

06-06-2006 08:09:38

Did you remember to add the stlport include directories to the top of the includes in the project file? If you want, I can send you a working codeblocks file, althoguh it only has static build options, I'm sure you could adapt it to use dlls :wink:

nihilocrat

07-06-2006 16:40:09

I've double-checked to make sure all the stlport-related stuff was added in for both the includes and the libs, but the same thing keeps happening. I would really like to try out that project file. Perhaps I just linked the OgreNewt dlls / libs incorrectly.

Here's my project file: http://nil.cjb.net/Emerge.cbp
It's not very useful because there's no code with it, but you might be able to look at the project settings.

mysterycoder

07-06-2006 17:05:39

Cool, I'll check it out when I get home in 3 or 4 hours.

mysterycoder

07-06-2006 20:15:25

I think I know what it is. :P
In the linker, you have stlport right after OgreMain, stlport should be at the very bottom of the list, so that all of the libraries that you linked will use it.

Macrobber

08-06-2006 17:14:09

Hey all,
I am using code blocks (yeah I know) and I am having some trouble getting OgreNewt to work.. Newton itself comes as an SDK and it installs fine; however, the OgreNewt only appears to come in a SLN file (so I am not sure which files to include when I attempt to build it.) Can someone let me know the steps they went through to get OgreNewt installed on CB?

Also, I get a “boost” error. The tutorial doesn’t mention boost (that I saw). Is this another dll that has to be built?

nihilocrat

08-06-2006 19:57:41

I reordered the libraries and I'm still getting the same errors. I even tried putting ogrenewt at the top with newton right under it.

Could you send me / post a copy of the OgreNewt lib / dll you've compiled to make sure that I didn't incorrectly compile my lib?

mysterycoder

09-06-2006 01:27:55

Sure, no problem :)
Did you also compile OgreNewt with the stlport headers, and link to stlport? You can't mix versions of stlport, and non-stlport libraries. I think the linker list needs to go Ogre, then OgreNewt, then stlport. I'll send you the project file for OgreNewt when I get home, and you can build it.

mysterycoder

09-06-2006 05:43:24

The link to the project file is http://sfp.homeip.net/OgreNewt.cbp, try building your demo against the dll you get when you compile OgreNewt with this project.

You'll need to add the newton include directory to the includes, make sure it is after stlport, but before the Ogre headers. If you get errors regarding newton.h, try adding #include <stddef.h> to the newton header.

In your application, when you link to OgreNewt, make sure the linker has this order: OgreMain, OgreNewt_Main, Newton, stlport.5.0

Also, in the application, the stlport include directory should be on top, and the Ogre include directory, the very last one.

I hope this helps, post back if you get errors :)

nihilocrat

12-06-2006 20:00:25

I get a 404 when trying to download your probject file. I will try again sometime later.

However, I tried using my existing project file for OgreNewt to compile a release DLL and got the same errors as I get when linking my game when trying to link the DLL. This is good, because it means I'm missing something when compiling OgreNewt and thus it's probably not a problem with the project settings on my game.

I seem to be set on the header side of things... I put 'typedef unsigned int size_t' in the Newton header but now I've switched it to stddef.h. Everything is compiling fine but the linker keeps failing.