News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

cannot find -lglut32.lib

Started by devGod, October 12, 2006, 07:25:11 PM

Previous topic - Next topic

devGod

Good day,

I'm having some trouble compiling/running some OpenGL code.

I've followed these steps:
http://www.mingw.org/MinGWiki/index.php/Glut

I have all the files, but I'm not completely sure if I put them in the right dirs.  :oops:

glut32.dll in CodeBlocks\bin
glut.h in CodeBlocks\include\GL
glut32.lib in CodeBlocks\lib

I got up till the point that I recieved this error when compiling:
QuoteE:\TEMP/ccMMoggb.o(.text+0x1c):t10.c: undefined reference to `__glutInitWithExit@12'
E:\TEMP/ccMMoggb.o(.text+0x3e):t10.c: undefined reference to `__glutCreateWindowWithExit@8'
E:\TEMP/ccMMoggb.o(.text+0x60):t10.c: undefined reference to `__glutCreateMenuWithExit@8'

If these are the only three undefined references then you probably linked with -lglut32 instead of glut32.lib.

So I tried playing with the glut32.lib in the linker.
Now I don't get the errors anymore. Instead I get 'cannot find -lglut32.lib'.

BTW, I'm trying to start out with the code example given in this topic:
http://forums.next.codeblocks.org/index.php?topic=2656.0

Build Log:
QuoteSwitching to target: default
Linking executable: D:\Documenten\Workspace\CodeBlocks\Project1\OpenGL.exe
C:\Program Files\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe: cannot find -lglut32.lib
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

tiwag

you need to add the directory where the linker has to look for the library

check Project->Build Options->Directories->Linker

devGod

#2
If I add 'C:\Program Files\CodeBlocks\lib' to the list I still get the error.  :(

-[EDIT]-
Sorry, forgot the trailing slash...

Now when I try to debug I get a compile error:
Build Log:
QuoteSwitching to target: default
Linking executable: D:\Documenten\Workspace\CodeBlocks\Project1\OpenGL.exe
mingw32-g++.exe: Files\CodeBlocks\lib -o D:\Documenten\Workspace\CodeBlocks\Project1\OpenGL.exe .objs\main.o        -lopengl32 -lglu32 -lgdi32 -luser32 -lkernel32 -lglut32.lib  -mwindows: No such file or directory
mingw32-g++.exe: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

Debugger
QuoteSelecting target: default
Compiling: failed
Aborting debugging session

nova

hmm, I'd suggest you try using Filemon from sysinternals (google it) to see what it says about what cannot be found.

get regmon sometime too, also useful, but probably not for this matter.

if filemon spams you too much you could try filtering its output ( control+l )

nova
[url="http://againsttcpa.com/what-is-tcpa.html"]http://againsttcpa.com/what-is-tcpa.html[/url]
[url="http://research.att.com/~bs"]http://research.att.com/~bs[/url]
neworder.box.sk

Rockeye

It seems that you haven't write it correctly. As far as i remember, when you specify a library, there 2 different ways :

1) you link the file "glut32.lib"
OR
2) you add the command "-lglut32" which automaticaly search for glut32.lib

That your compiler says :
Quotecannot find -lglut32.lib

It is looking for the file "-lglut32.lib" on your filesystem, which of course doesn't exist...

Choose one of the possibility, but not both. That should solve your error...

MortenMacFly

Enable full compiler log (see my sig) and re-post, please.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Multinode Nick

Hi,

I have the same problem here with any static library (.lib), I also tested with glut.lib of course...

- I add folders link in Project/Build Options/Directories (include & lib).
- I add glut.lib and then (on compile) I get this error : cannot find –lglut.lib
- I believe this is an IDE vs ld.exe/gcc.exe integration  bug, so I remove .lib in the library name (glut).

It now seems to recognize the library, but I can't use anything in there. I get this error:
undefined reference to '__glutCreateWindowWithExit@8.

I had some doubt so I created my own .lib (in VS), I get the same errors. But if I create la static lib (.a) with the same code in C::B, everything's fine and works.

Did I do something wrong?

Nick