Author Topic: OpenSceneGraph (+ SDL)  (Read 7639 times)

mjpm

  • Guest
OpenSceneGraph (+ SDL)
« on: November 13, 2006, 05:58:53 pm »
Hello,

I'm trying to get OpenSceneGraph (http://www.openscenegraph.org/) to work with CB.
I set the include and lib paths in CB but I get many errors when trying to compile one of the examples.



Like this:

Code: C++
  1. Compiling: C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.cpp
  2. Linking console executable: C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.exe
  3. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x33d): undefined reference to `_imp___ZN8Producer13RenderSurfaceC1Ev'
  4. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x3f4): undefined reference to `_imp___ZN8Producer13RenderSurface13setWindowNameERKSs'
  5. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4b6): undefined reference to `_imp___ZN8Producer13RenderSurface18setWindowRectangleEiijjb'
  6. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4d3): undefined reference to `_imp___ZN8Producer13RenderSurface9useBorderEb'
  7. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4f8): undefined reference to `_imp___ZN8Producer13RenderSurface7realizeEPNS_13VisualChooserEP7HGLRC__'
  8. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x522): undefined reference to `_imp___ZN7osgUtil9SceneViewC1EPN3osg15DisplaySettingsE'
  9. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x59f): undefined reference to `_imp___ZN7osgUtil9SceneView11setDefaultsEj'
  10. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x5cf): undefined reference to `_imp___ZN7osgUtil9SceneView12setSceneDataEPN3osg4NodeE'
  11. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x71c): undefined reference to `_imp___ZN3osg7Matrixd10makeLookAtERKNS_5Vec3dES3_S3_'
  12. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x72d): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
  13. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x737): undefined reference to `_imp___ZNK3osg5Timer4tickEv'
  14. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x76c): undefined reference to `_imp___ZNK8Producer13RenderSurface10isRealizedEv'
  15. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x796): undefined reference to `_imp___ZN3osg10FrameStampC1Ev'
  16. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x7f3): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
  17. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x807): undefined reference to `_imp___ZNK3osg5Timer4tickEv'
  18. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x81a): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
  19. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x8d7): undefined reference to `_imp___ZNK8Producer13RenderSurface15getWindowHeightEv'
  20. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x8f2): undefined reference to `_imp___ZNK8Producer13RenderSurface14getWindowWidthEv'
  21. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN3osg10CameraNode13setViewMatrixERKNS_7MatrixdE[osg::CameraNode::setViewMatrix(osg::Matrixd const&)]+0x24): undefined reference to `_imp___ZN3osg4Node10dirtyBoundEv'
  22. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN7osgUtil9SceneView11setViewportEiiii[osgUtil::SceneView::setViewport(int, int, int, int)]+0x38): undefined reference to `_imp___ZN3osg10CameraNode11setViewportEiiii'
  23. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN3osg7MatrixdC1Ev[osg::Matrixd::Matrixd()]+0xd): undefined reference to `_imp___ZN3osg7Matrixd12makeIdentityEv'
  24. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0x86): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
  25. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0xbb): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
  26. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0xe): undefined reference to `_imp___ZN5osgDB8Registry8instanceEb'
  27. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x27): undefined reference to `_imp___ZN5osgDB12readNodeFileERKSsPKNS_12ReaderWriter7OptionsE'
  28. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x62): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
  29. C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x6d): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
  30. collect2: ld returned 1 exit status
  31. Process terminated with status 1 (0 minutes, 5 seconds)
  32. 0 errors, 0 warnings

Maybe someone has worked with OSG and CB in combination and can give me a hint?!

As a second part of this question, has anyone worked with SDL and OSG in combination?
I wanted to use SDL for window handling and maybe event handling.


Regards,

Marcel

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: OpenSceneGraph (+ SDL)
« Reply #1 on: November 13, 2006, 06:16:42 pm »
It looks like it isn't actually finding any of the libraries.  Have you added the OSG libraries to the linker(not just the path?).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: OpenSceneGraph (+ SDL)
« Reply #2 on: November 13, 2006, 06:21:17 pm »
Please repeat the log having enabled the *full* compiler log (see my sig).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #3 on: November 14, 2006, 12:29:25 am »
Hello,

I found two files for the example

Code: C++
  1. // C++ source file - (C) 2003 Robert Osfield, released under the OSGPL.
  2. //
  3. // Simple example of use of Producer::RenderSurface to create an OpenGL
  4. // graphics window, and OSG for rendering.
  5.  
  6. #include <Producer/RenderSurface>
  7. #include <osg/Timer>
  8. #include <osgUtil/SceneView>
  9. #include <osgDB/ReadFile>
  10.  
  11.  
  12. int main( int argc, char **argv )
  13. {
  14.     if (argc<2)
  15.     {
  16.         std::cout << argv[0] <<": requires filename argument." << std::endl;
  17.         return 1;
  18.     }
  19.  
  20.     // load the scene.
  21.     osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(argv[1]);
  22.     if (!loadedModel)
  23.     {
  24.         std::cout << argv[0] <<": No data loaded." << std::endl;
  25.         return 1;
  26.     }
  27.  
  28.     // create the window to draw to.
  29.     osg::ref_ptr<Producer::RenderSurface> renderSurface = new Producer::RenderSurface;
  30.     renderSurface->setWindowName("osgsimple");
  31.     renderSurface->setWindowRectangle(100,100,800,600);
  32.     renderSurface->useBorder(true);
  33.     renderSurface->realize();
  34.  
  35.     // create the view of the scene.
  36.     osg::ref_ptr<osgUtil::SceneView> sceneView = new osgUtil::SceneView;
  37.     sceneView->setDefaults();
  38.     sceneView->setSceneData(loadedModel.get());
  39.  
  40.     // initialize the view to look at the center of the scene graph
  41.     const osg::BoundingSphere& bs = loadedModel->getBound();
  42.     osg::Matrix viewMatrix;
  43.     viewMatrix.makeLookAt(bs.center()-osg::Vec3(0.0,2.0f*bs.radius(),0.0),bs.center(),osg::Vec3(0.0f,0.0f,1.0f));
  44.  
  45.     // record the timer tick at the start of rendering.
  46.     osg::Timer_t start_tick = osg::Timer::instance()->tick();
  47.  
  48.     unsigned int frameNum = 0;
  49.  
  50.     // main loop (note, window toolkits which take control over the main loop will require a window redraw callback containing the code below.)
  51.     while( renderSurface->isRealized() )
  52.     {
  53.         // set up the frame stamp for current frame to record the current time and frame number so that animtion code can advance correctly
  54.         osg::ref_ptr<osg::FrameStamp> frameStamp = new osg::FrameStamp;
  55.         frameStamp->setReferenceTime(osg::Timer::instance()->delta_s(start_tick,osg::Timer::instance()->tick()));
  56.         frameStamp->setFrameNumber(frameNum++);
  57.  
  58.         // pass frame stamp to the SceneView so that the update, cull and draw traversals all use the same FrameStamp
  59.         sceneView->setFrameStamp(frameStamp.get());
  60.  
  61.         // update the viewport dimensions, incase the window has been resized.
  62.         sceneView->setViewport(0,0,renderSurface->getWindowWidth(),renderSurface->getWindowHeight());
  63.  
  64.         // set the view
  65.         sceneView->setViewMatrix(viewMatrix);
  66.  
  67.         // do the update traversal the scene graph - such as updating animations
  68.         sceneView->update();
  69.  
  70.         // do the cull traversal, collect all objects in the view frustum into a sorted set of rendering bins
  71.         sceneView->cull();
  72.  
  73.         // draw the rendering bins.
  74.         sceneView->draw();
  75.  
  76.         // Swap Buffers
  77.         renderSurface->swapBuffers();
  78.     }
  79.  
  80.     return 0;
  81. }
  82.  
  83.  

which are

GNUmakefile.inst
Code: [Select]
TOPDIR = ../..
include $(TOPDIR)/Make/makedefs

CXXFILES =\
osgsimple.cpp\

LIBS     += -lProducer -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)

EXEC = osgsimple

INC += $(PRODUCER_INCLUDE_DIR) $(X_INC)
LDFLAGS  += $(PRODUCER_LIB_DIR)

include $(TOPDIR)/Make/makerules


and

GNUmakefile
Code: [Select]
TOPDIR = ../..
include $(TOPDIR)/Make/makedefs

CXXFILES =\
osgsimple.cpp\

LIBS     += -lProducer -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads

INSTFILES = \
$(CXXFILES)\
GNUmakefile.inst=GNUmakefile

EXEC = osgsimple

INC      += $(X_INC)
LDFLAGS  += -L/usr/X11R6/lib


ifeq ($(USE_OPEN_THREAD),1)
    DEF         += -D_USE_OPEN_THREAD
    INC         += $(INC_OPEN_THREAD)
    LDFLAGS     += $(LIB_OPEN_THREAD)
    LIBS        +=  -lOpenThread
endif

include $(TOPDIR)/Make/makerules



So I added Producer.lib, osgDB.lib, osgUtil.lib, osg.lib and OpenThreadsWin32.lib to Settings -> Compiler and debugger -> Linker -> Link libraries without success.

Code: [Select]
mingw32-g++.exe -Wall -g  -I"C:\Program Files\MinGW\include" -I"C:\Program Files\SDL\include" -I"C:\Program Files\OpenSceneGraph\include"  -c "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.cpp" -o "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o"
mingw32-g++.exe -L"C:\Program Files\MinGW\lib" -L"C:\Program Files\SDL\lib" -L"C:\Program Files\OpenSceneGraph\lib"  -o "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.exe" "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o"   "C:\Program Files\OpenSceneGraph\lib\osgUtil.lib" "C:\Program Files\OpenSceneGraph\lib\Producer.lib" "C:\Program Files\OpenSceneGraph\lib\OpenThreadsWin32.lib" "C:\Program Files\OpenSceneGraph\lib\osg.lib" "C:\Program Files\OpenSceneGraph\lib\osgDB.lib"
C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o: In function `main':
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:29: undefined reference to `_imp___ZN8Producer13RenderSurfaceC1Ev'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:30: undefined reference to `_imp___ZN8Producer13RenderSurface13setWindowNameERKSs'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:31: undefined reference to `_imp___ZN8Producer13RenderSurface18setWindowRectangleEiijjb'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:32: undefined reference to `_imp___ZN8Producer13RenderSurface9useBorderEb'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:33: undefined reference to `_imp___ZN8Producer13RenderSurface7realizeEPNS_13VisualChooserEP7HGLRC__'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:36: undefined reference to `_imp___ZN7osgUtil9SceneViewC1EPN3osg15DisplaySettingsE'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:37: undefined reference to `_imp___ZN7osgUtil9SceneView11setDefaultsEj'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:38: undefined reference to `_imp___ZN7osgUtil9SceneView12setSceneDataEPN3osg4NodeE'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:43: undefined reference to `_imp___ZN3osg7Matrixd10makeLookAtERKNS_5Vec3dES3_S3_'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:46: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:46: undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:51: undefined reference to `_imp___ZNK8Producer13RenderSurface10isRealizedEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:54: undefined reference to `_imp___ZN3osg10FrameStampC1Ev'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:62: undefined reference to `_imp___ZNK8Producer13RenderSurface15getWindowHeightEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:62: undefined reference to `_imp___ZNK8Producer13RenderSurface14getWindowWidthEv'
C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o: In function `ZN3osg7ref_ptrINS_10FrameStampEED1Ev':
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN3osg10CameraNode13setViewMatrixERKNS_7MatrixdE[osg::CameraNode::setViewMatrix(osg::Matrixd const&)]+0x24): undefined reference to `_imp___ZN3osg4Node10dirtyBoundEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN7osgUtil9SceneView11setViewportEiiii[osgUtil::SceneView::setViewport(int, int, int, int)]+0x38): undefined reference to `_imp___ZN3osg10CameraNode11setViewportEiiii'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN3osg7MatrixdC1Ev[osg::Matrixd::Matrixd()]+0xd): undefined reference to `_imp___ZN3osg7Matrixd12makeIdentityEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0x86): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0xbb): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0xe): undefined reference to `_imp___ZN5osgDB8Registry8instanceEb'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x27): undefined reference to `_imp___ZN5osgDB12readNodeFileERKSsPKNS_12ReaderWriter7OptionsE'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x62): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x6d): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 6 seconds)
18 errors, 0 warnings
 

I also tried adding all other libs and #including the gl headers as it reads "GL_LIBS" in the makefile, all with no success.


Regards,

Marcel

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: OpenSceneGraph (+ SDL)
« Reply #4 on: November 14, 2006, 02:39:03 am »
Why do you have the full library path there?  You should just add the name of the library, the part after the "-l" in the Makefile.  The '-L"C:\Program Files\OpenSceneGraph\lib"' (which is where the library is) tell the linger where to look for them.

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #5 on: November 14, 2006, 06:55:52 am »
Hello,

when I insert the libs via the browse button, it gets inserted with the full command line.
And when I delete the rest of the command line and just leave the lib name like Producer.lib compilink/linking stops at the very first lib, because it can not be found.

I also tried combinations of backslah trailing in the lib path and enforcing quotes etc., still no success.


Regards,
Marcel

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #6 on: November 14, 2006, 08:23:30 am »
Hello,

the problem is solved.

The Problem is that the release just is not suitable for MingW, it could not work.
For MingW I have to compile it all myself.


Regards,
Marcel