Author Topic: cannot find -lglut32.lib  (Read 29795 times)

devGod

  • Guest
cannot find -lglut32.lib
« on: October 12, 2006, 07:25:11 pm »
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:
Quote
E:\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.codeblocks.org/index.php?topic=2656.0

Build Log:
Quote
Switching 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
 
« Last Edit: October 12, 2006, 07:30:50 pm by devGod »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: cannot find -lglut32.lib
« Reply #1 on: October 12, 2006, 07:29:48 pm »
you need to add the directory where the linker has to look for the library

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

devGod

  • Guest
Re: cannot find -lglut32.lib
« Reply #2 on: October 12, 2006, 07:34:38 pm »
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:
Quote
Switching 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
Quote
Selecting target: default
Compiling: failed
Aborting debugging session
« Last Edit: October 12, 2006, 07:38:02 pm by devGod »

Offline nova

  • Single posting newcomer
  • *
  • Posts: 5
Re: cannot find -lglut32.lib
« Reply #3 on: October 23, 2006, 06:51:18 am »
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

Rockeye

  • Guest
Re: cannot find -lglut32.lib
« Reply #4 on: October 26, 2006, 11:00:22 am »
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 :
Quote
cannot 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...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: cannot find -lglut32.lib
« Reply #5 on: October 26, 2006, 11:14:59 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Multinode Nick

  • Guest
Re: cannot find -lglut32.lib
« Reply #6 on: November 21, 2006, 05:23:22 pm »
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