User forums > Using Code::Blocks
OpenGL Linker problem.
radioact1ve:
Hello everyone!
Hows it going?! I have been messing with C::B(v1, rc2) for the last couple of days, I always knew it was good, just didn't use it. Anyway, onto my question.
How do you set up C::B with OpenGL (version that comes with CB)? Let me explain. Like I said for the last couple of days, I have been trying to set it up to no success. Funny because the same problem I have, after searching the forums, is very common but there was never a solution. Google couldn't even help me out here.
Basically, on WinXP trying to get C::B to run a simple opengl and glut.
This is the error I'm getting, which I'm pretty sure has do to with the "linking process":
--- Code: ---mingw32-g++.exe "-D_WCHAR_T_DEFINED " -I"C:\Program Files\CodeBlocks\include" -c Simple.cpp -o .objs\Simple.o
mingw32-g++.exe -L"C:\Program Files\CodeBlocks\lib" -o "C:\Documents and Settings\radioact1ve\Desktop\Programming\CB\OpenGL.exe" .objs\Simple.o -lglut32 -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 -mwindows
.objs\Simple.o:Simple.cpp:(.text+0x1c): undefined reference to `__glutInitWithExit'
.objs\Simple.o:Simple.cpp:(.text+0x37): undefined reference to `__glutCreateWindowWithExit'
.objs\Simple.o:Simple.cpp:(.text+0x53): undefined reference to `__glutCreateMenuWithExit'
...... Insert a whole bunch of undefines here
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
--- End code ---
As you can see from the message, that's the order that I'm linking the libs. Truth be told I have been using many different combinations b/c the forums and Google keep giving me different orders, and it worked for them.
I have tried to be as detailed as possible, if more info is needed please let me know. Hope anyone can help!! I know this has been asked before but I haven't found a workable solution. Thanks for your time!!
BTW, The basic template that comes with C::B when you create a new OpenGL project compiles but it doesn't run. The "time" cursor on the mouse appears for like a second and nothing happens. My guess is that something is failing so the app just exists. Thought I would share that.
Vampyre_Dark:
Do you have GLUT? It's not a part of OpenGL, it's an external library.
Do you have your linker and include folders set in CB so that it can find your libraries?
MortenMacFly:
--- Quote from: radioact1ve on April 12, 2006, 04:26:08 am ---I have been messing with C::B(v1, rc2) [...]
--- End quote ---
As usual question: Did you try one of the nigtlys?
Anyway: I believe there is NO GLUT template that ships with C::B. The only thing are a "generic" OpenGL tamplate and a GLFW template. Anyway: I'm providing you with a GLUT template as attachment. Copy the content of the archive to the [C::B]\share\CodeBlocks\templates folder. This template requires one of the nightlies as is uses features that are not availabe in RC2 and below. In addition it requires the path to the GLUT SDK to be setup (it will ask you to setup a global variable accordingly). I doenloaded the GLUT Devpack (do a google search for it, version 3.7.6) and setup the path to this directory.
This template compiles fine and works well on my machine (Windows with MinGW).
I'm going to post this as a patch to BerliOS, soon.
With regards, Morten.
EDIT: I've uploaded the patch by now (#992). We'll see if and when the admins agree and apply it to SVN.
[attachment deleted by admin]
thomas:
GLUT is generally a troublemaker. It is unmaintained for a couple of years now.
Once upon a time (in the ages of Dev-CPP), I used the original binary from Nate Robins' site: http://www.xmission.com/~nate/glut.html
You may want to try that one if the DevPak does not work for you (for some reason, it did not work for me).
If you can, try to do without GLUT alltogether (or use freeglut, which is at least being maintained). Usually, people only ever need GLUT to compile a 5-8 year old OpenGL demo code sample, not for actually developing something.
If you aren't afraid of trying something completely different, you should consider using GLFW. It does not have all of GLUT's functions (you don't need most of them anyway), but it is quite good if you want to open a window that does OpenGL, catch mouse and keyboard input, etc. It is cross-platform, reliable, and very lightweight. There is a template for GLFW coming with Code::Blocks, and instructions on how to build the library in the WiKi.
bluekid:
look here
http://forums.codeblocks.org/index.php?topic=2656.0
download
http://file004.mylivepage.com/chunk4/57394/35/Code%20Blocks%20i%C3%A7in%20GLUT%20full%20paket%20.zip
full Glut !
- Library Files for Mingw32
- C::B Template for GLUT
- Tutorial with Example C::B projects
- glut-3.spec.pdf
- Glut-Puzzle ! - from FLTK examples
Navigation
[0] Message Index
[#] Next page
Go to full version