1

I have to integrate osg into my project on code blocks. In osg web site, there is only one unanswered post.

Has anyone used osg and codeblocks together?

mucisk
  • 247
  • 5
  • 13

1 Answers1

1

I assume you're developing on windows from your tags.
Ok. If you havent set up OSG already, checkout this blog for instructions on compiling with MingW/MSYS.
The OSG wiki considers the article to be more up to date (as at May-26-13') than its wiki entry.
There's also binaries at the bottom to save you time.

Next, fire up C::B and create a new C++ console application. Follow the wizard thru to the end. Select MingW/GCC as your compiler.

  1. Create a new set of Global Variables. Settings -> Global Variables
  2. Call the new variable "OSG".
  3. Set the "base" field to your OSG root folder
    • Optional: Set the "include" field to your OSG include folder
    • Optional: Set the "lib" field to your OSG libs folder
  4. Open project -> build options.
    • go to the "Search Directories" tab
    • under the "compiler" tab add $(#OSG.include)
    • under the "linker" tab add $(#OSG.lib)
  5. Click the "Linker Setings" tab and copy paste the following libs (according to your projects needs) under the "Other linker options" textbox. Each should be separated by a new-line AS IS.
    -losg 
    -losgGA 
    -losgDB 
    -losgViewer
    -losgText 
    -losgUtil 
    -lOpenThreads
    
  6. Click ok.
  7. Goto File -> Save everything (optional but if C::B crashes, you might wish you did this)
  8. Copy paste all the code from this tut/example into your main.cpp and try compiling.

Make a good game/3d app if it works, otherwise Let me know if it mis-behaves.

mrmoje
  • 3,714
  • 3
  • 20
  • 18
  • On building in Debian Jessie (GNU GCC): (File: ld) Message: cannot find -losg; cannot find -losgGA... – Rodrigo Mar 01 '17 at 04:03
  • Got it! Since I couldn't compile OSG, I needed to proper install it (sudo apt-get install libopenscenegraph-dev openscenegraph). From here: http://forum.openscenegraph.org/viewtopic.php?t=1363 – Rodrigo Mar 01 '17 at 04:09
  • On the current build of OSG which I have downloaded there is no "lib" directory I can find. Please let me know which directory has the lib files. It will be helpful! Thanks – user2311285 Jul 12 '17 at 12:32