User forums > Using Code::Blocks

Having a hard time running OpenGL samples with codeblocks.

<< < (2/3) > >>

indigo0086:

--- Quote from: MortenMacFly on February 23, 2007, 04:32:08 pm ---
--- Quote from: indigo0086 on February 23, 2007, 02:46:56 pm ---mingw32-g++.exe -LZ:\mingw\lib -LZ:\MinGW\lib  -o bin\Debug\Simple.exe obj\Debug\Simple.o    -lopengl32 -lglu32 -lgdi32 -lglut32.lib -llglut32.lib
Z:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lglut32.lib

--- End quote ---
You *need* the GLUT library and headers if you want to compile 3GLUT applications. They are *not* provided with MinGW. Try google and/or download the GLUT DevPack. Then add the path of the GLUT headers to the compiler options and the path to the GLUT libs to the linker options.
The very same applies to freeGLUT. IMHO there is a pre-compiled DevPack available, too. Nothing required to compile yourself here (except your very application), just make your project aware of where to find (free)GLUT stuff.
With regards, Morten.

--- End quote ---

ok, here's what I did. 
1) downloaded glut, put glut32.lib in the lib folder of mingw, put glut.h in include/gl of mingw.
2)Created a new project with the opengl template.
3)went to the build options (the universal, not release/debug specific) as show in attachment 1
4) added glut32 to the linker
received the following errors

--- Code: ---obj\Release\Simple.o:Simple.cpp:(.text+0x17):: undefined reference to `__glutCreateMenuWithExit@8'
obj\Release\Simple.o:Simple.cpp:(.text+0x8f):: undefined reference to `__glutInitWithExit@12'
obj\Release\Simple.o:Simple.cpp:(.text+0xe6):: undefined reference to `__glutCreateWindowWithExit@8'
:: === Build finished: 3 errors, 0 warnings ===

--- End code ---
5) I changed the linker lib to glut32.lib but received

--- Code: ---ld.exe:: cannot find -lglut32.lib
:: === Build finished: 1 errors, 0 warnings ===

--- End code ---


[attachment deleted by admin]

Biplab:

--- Quote from: indigo0086 on February 23, 2007, 05:04:49 pm ---1) downloaded glut, put glut32.lib in the lib folder of mingw, put glut.h in include/gl of mingw.
2)Created a new project with the opengl template.
3)went to the build options (the universal, not release/debug specific) as show in attachment 1
4) added glut32 to the linker
received the following errors

--- Code: ---obj\Release\Simple.o:Simple.cpp:(.text+0x17):: undefined reference to `__glutCreateMenuWithExit@8'
obj\Release\Simple.o:Simple.cpp:(.text+0x8f):: undefined reference to `__glutInitWithExit@12'
obj\Release\Simple.o:Simple.cpp:(.text+0xe6):: undefined reference to `__glutCreateWindowWithExit@8'
:: === Build finished: 3 errors, 0 warnings ===

--- End code ---

--- End quote ---

You can't use glut32.lib (most probably VC compiled) with MinGW. You need library compiled with gcc and with *.a extension. :)

indigo0086:
 :x

Things like that are great to know before you spend all morning figuring out what to do.

Also, dev-pack freezes on me whenever I try to use it.

wxLearner:
If the MinGW linker says -lglut32.lib, it looks for a file called libglut32.lib.a.
You can try to rename your glut32.lib to libglut32.lib.a, or specify a path in the libraries list, but I don't know, if linking with .lib files will work. MinGW supports linking directly to a dll, but for this case you also have to specify a path in the libraries list. It can be a relative path, but if the library is in the same directory you have to explicitely write .\mylib.dll with the preceding .\ (choosing it with the Code::Blocks file browser omits the necessary .\ and makes the linker think, you want to link libmylib.dll.a instead of mylib.dll)

Biplab:
There is an easy solution. A *.devpak file is basically a *.tar.bz2 file. Rename the devpak file to a *.tar.bz2 file and then extract it using any De-compressor, e.g., 7-zip.

You'll get all the contents easily. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version