Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top