Issues with Linux

penneydude

17-05-2006 03:02:50

I've been using Ogre for a little while now, just making simple little programs to get some experience programming with Ogre, and I decided to try out OgreNewt for my physics. I'm using Gentoo, and it took a little whle to get my program to compile by simply including the OgreNewt headers and declaring a world, but I got it.

The next logical step, I figured, would be to include some code to update the world and stick it in my frame listener, which I did, but I'm now getting these errors:

/tmp/cceJpFg2.o(.gnu.linkonce.t._ZN20CSimpleFrameListener12frameStartedERKN4Ogre10FrameEventE+0x725): In function `CSimpleFrameListener::frameStarted(Ogre::FrameEvent const&)':
: undefined reference to `OgreNewt::World::update(float)'
/tmp/cceJpFg2.o(.gnu.linkonce.t._ZN20CSimpleFrameListener12frameStartedERKN4Ogre10FrameEventE+0x762): In function `CSimpleFrameListener::frameStarted(Ogre::FrameEvent const&)':
: undefined reference to `OgreNewt::World::update(float)'
collect2: ld returned 1 exit status


The code that I put in the frame listener is this:

elapsed += evt.timeSinceLastFrame;

if ((elapsed > fupdate) && (elapsed < (1.0f)) )
{
while (elapsed > fupdate)
{
tehWorld->update( fupdate );
elapsed -= fupdate;
}
}
else
{
if (elapsed < (fupdate))
{
// not enough time has passed this loop, so ignore for now.
}
else
{
tehWorld->update( elapsed );
elapsed = 0;
}
}


tehWorld is the world that I declared earlier in the program, and fupdate is just a Real with a value of 1/60, to denote 60 fps. Can anyone help me out? I honestly have no clue what I did wrong.

penneydude

18-05-2006 00:36:50

Ok, I think I may have managed to find the source of the problem, and it's my makefile. I've tried screwing around with it, but I don't know too much about makefiles. Here it is:

DEFINES = -lOgreMain -lOgreNewt /usr/lib/libCEGUIBase.so -lCEGUIOgreRenderer -I../../ogrenewt/inc -I../../newtonSDK/sdk -L../../ogrenewt/lib/release -L../../ogrenewt/src
LIBS = OGRE
CXX = g++
CXXFLAGS = $(shell pkg-config --cflags $(LIBS)) $(DEFINES)
LD = g++
LDFLAGS = $(shell pkg-config --libs $(LIBS))

all:
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o trial1 trial1.cpp

clean:
rm -f trial1


If someone could help me get it working I'd appreciate it.

helloween

18-05-2006 02:56:11

Im not a linux expert, and I never understood how a makefile works, what you should try is to compile it manually with gcc like this if i remenber well :)
gcc -c all_your_cppfile -I../includes_folders

then link all the objects defining the library path and each library you need like this:

gcc -o name_of_outputfile allyour_object_File -L../libraryfolders -logreMain -lceguibase -lceguipgrerenderer -logrenewt

also, your makefile doesn't look like it bind to newton library, try to add it with -L../newtonFolder -lnewton_library_filename

:?

penneydude

18-05-2006 03:09:44

Interestingly, it compiled and linked when I did it manually, but now I'm getting a segmentation fault. Ogre.log doesn't say anything differently, it just kind of cuts off. Maybe I'll play with the code a bit and see what the deal is. Thanks for the help!

penneydude

18-05-2006 03:17:12

Alright, I found the culprit of my Segfault problem. It's this line:

tehWorld->update(evt.timeSinceLastFrame);

I don't really know what's wrong with it. It's in the frameStarted part of my frame listener. The only two things that reference OgreNewt in my source are the declaration of the world and that line. Do I actually need OgreNewt objects in my world before I can call world->update?

penneydude

18-05-2006 04:22:55

Wow, it's just one problem after another here. I fixed my last problem, turns out I declared a world but never actially initialized it. Now, my problem is when I'm trying to make a body. My code looks like this:

OgreNewt::Collision* col2 = new OgreNewt::CollisionPrimitives::Box( tehWorld, shipNode->getScale() );
OgreNewt::Body* topShip = new OgreNewt::Body( tehWorld, col2 );


But I get these errors:

trial1.cpp:342: error: no matching function for call to `OgreNewt::Body::Body(
OgreNewt::World*&, OgreNewt::Collision*&)'
../../ogrenewt/inc/OgreNewt_Body.h:43: error: candidates are:
OgreNewt::Body::Body(const OgreNewt::Body&)
../../ogrenewt/inc/OgreNewt_Body.h:85: error:
OgreNewt::Body::Body(const OgreNewt::World*,
Ogre::SharedPtr<OgreNewt::Collision>, int)


I'm just following the tutorial in the wiki, and I've seen no mention of a different way to declare a body, other than Body(world,collision object). Was this recently changed and I need to change my code? Or did I just make some ridiculously simple mistake again?

helloween

18-05-2006 15:22:51

that's weird :?:
the syntaxe must be different then for linux version, I cant help you there, try to pass the other differents way the compilor proposes, like const, sharedptr, reference, ect....

walaber

19-05-2006 15:56:46

that is the only way to create a Body... something must be wrong in your code...

penneydude

20-05-2006 00:15:23

Well, I was using a linux version of OgreNewt that you used scons to compile the libs with (I found it on these forums), but I guess something was screwed up with the headers, so I managed to hack together bits and pieces of that and the standard OgreNewt library to make it work. Thanks for the responses!

persoontje

04-06-2006 14:17:46

Well, I was using a linux version of OgreNewt that you used scons to compile the libs with (I found it on these forums), but I guess something was screwed up with the headers, so I managed to hack together bits and pieces of that and the standard OgreNewt library to make it work. Thanks for the responses!

How have you done that? Or could you mail your version of the OgreNewt lib? I also like to use orge and newton cross platform. :lol: