Author Topic: Code::Blocks linker and glui  (Read 13596 times)

Mushu

  • Guest
Code::Blocks linker and glui
« on: April 15, 2009, 06:10:13 pm »
Hello,

I've tried to build an opengl project in C++ including a glui interface but I get allways a linking error. I've searched for different libraries (libglui.a, glui32.lib) but none works.

I'm here to ask you if there is a way for glui to work with Code::Blocks.

See you.

PS : Excuse my english :D

Offline Ganbito

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Code::Blocks linker and glui
« Reply #1 on: April 15, 2009, 10:21:10 pm »
I've searched for different libraries (libglui.a, glui32.lib) but none works.

One question, did you download and build the library? or (as I guess that you are under a linux distribution) did you have the right developement package installed?

If you have the library installed, it can be linked as any other library; go to "Project->Build options...->Linker settings" and:
  • Click the "Add" and select there your library (with path if required).
  • On linux, you may use the appropriate `pkgconfig libname` statement in "Other linker options"

You should provide more infomation: SO, compiler... in order to better help you.

Mushu

  • Guest
Re: Code::Blocks linker and glui
« Reply #2 on: April 16, 2009, 11:02:11 am »
Hello,
I'm working on windows using MinGW.

When I build it I've this kind of errors :
"undefined reference to `_GLUI_Master' ",
"undefined reference to `GLUI_Master_Object::create_glui(char*, long, int, int)'",
"undefined reference to `GLUI::add_radiogroup(int*, int, void (*)(int))'".
Allways the same.

To install glui :

I placed glui.h in the same folder as the others Opengl librairies, in : "C:\Program Files\CodeBlocks\MinGW\include\GL".
In my source code I declared it as my others include : #include <GL/glui.h>.

The different librairies I used where the ones I found on internet, I don't know how to build them so I've searched for precompiled librairies.

To configure the linker I went in :
Project->Buid Options->"Name of the project"->Linker Settings and here I've add the librairy glui that I put before in :
"C:\Program Files\CodeBlocks\MinGW\lib".

I'm sure that the source code works because I tried it on another IDE.

I hope these informations could help you to help me. ;)

Edit : I've tried to use glui on Ubuntu but it doesn't work. As I'm a noob with Linux (I'm using it since last week), my priority is to make GLUI work on Windows.
« Last Edit: April 16, 2009, 11:36:33 am by Mushu »

Offline Ganbito

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Code::Blocks linker and glui
« Reply #3 on: April 16, 2009, 01:33:49 pm »
I don't know why you can't build it yourself. By the way, that is out of the scope of this forum, so I won't help with that.

I've don't use windows too much, I use ubuntu 8.04, so I tried to get it to work on it. It was easy:

- Install the packagle "libglui-dev". Either from synaptic or from command line (sudo apt-get install libglui-dev). It automatically installs all required packages.
- Go to codeblocks and create a new empty project. Add the files you want (I've tried some examples that I found on the web).
- Now you have to add the needed libraries as described in the GLUI manual. Go to "Project->Build options...->Linker settings->Link libraries:" and Add:
  • /usr/lib/libglui.so
  • /usr/lib/libglut.so
  • /usr/lib/libglu.so
  • /usr/lib/libgl.so
And now I can build and run the examples. I also test .a libraries, except for libgl, with only came with .so, and them build and run too.

So, for windows, I guess that you need to add the same libraries (.a, .lib or .dll) from their respective directories.

You may also need to go to "Project->Build options...->Search directories->Linker" and add the directories where you have the include files (GL/glui.h, GL/glut.h....). This is necessary if you get errors like "can't open include file xxxx.h ...".

EDIT: The library adding method I described above is generic (work on any system, using the right paths). In linux is easier. Just go to "Project->Build options...->Linker settings->Other linker settings" and write there "-lglui -lglut -lGLU -lGL".
« Last Edit: April 16, 2009, 01:43:09 pm by Ganbito »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code::Blocks linker and glui
« Reply #4 on: April 17, 2009, 01:21:13 am »
I'm here to ask you if there is a way for glui to work with Code::Blocks.
IMHO there is a wizard for that. Otherwise: Add the required include path's to the compiler/linker as needed, ling against the GL and GLUI libs (probably GLU and GLUT, too) in the right order and you are done.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ