Author Topic: ld.exe cannot find -lfreeglut  (Read 24835 times)

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
ld.exe cannot find -lfreeglut
« on: December 03, 2011, 11:26:55 pm »
Using Windows Vista Premium, FirePro 2270 graphics card. Fresh download of code::blocks and also of freeglut. Go to CB and try the "Hello World" default program and get the above message.
I can not find any relevant advice on the web.
Please HELP!!
« Last Edit: December 04, 2011, 06:32:55 pm by searcher »


Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #2 on: December 04, 2011, 10:43:54 pm »
Using Windows Vista Premium, FirePro 2270 graphics card. Fresh download of code::blocks and also of freeglut. Go to CB and try the "Hello World" default program and get the above message.
I can not find any relevant advice on the web.
Please HELP!!

Did you read my tutorial on how to install freeGlut with C::B ?

http://wiki.codeblocks.org/index.php?title=Using_FreeGlut_with_Code::Blocks

You must read it thoroughly to understand it. Also, make sure your FILE extensions are visible. I am going to have to update my tutorial sometime soon, because I am constantly being asked why they cannot see the files to edit that I stated in the tut. You can change your extensions in the Windows Explorer ORGANIZE.  So its ORGANIZE --> FOLDER AND SEARCH OPTIONS --> VIEW ( TAb ) and then you should see where its saying to hide the file extensions. You do NOT want to hide your extensions except your protected system files. Leave those hidden.

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: ld.exe cannot find -lfreeglut
« Reply #3 on: December 05, 2011, 04:02:31 am »
Yes I have read your instructions - 2 weeks ago I had that demo program running. So, I decided to start from scratch following your instructions as carefully as possible. All seemed to go well until I tried to edit the glut.cbp file. CB would not allow me to edit the file directly so I went to notepad and made the change as requested and replaced the file in the original location. Now when I try to set up the testing demo I get some info tabs about something being outdated and asking me to define glut !!
I tried running the classic console program "Hello World" (with both versions of glut.cbp) and still get the message :  ld.exe cannot find -lfreeglut32.
If you have any further advice it will be appreciated. Many thanks.

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #4 on: December 05, 2011, 06:23:02 am »
Yes I have read your instructions - 2 weeks ago I had that demo program running. So, I decided to start from scratch following your instructions as carefully as possible. All seemed to go well until I tried to edit the glut.cbp file. CB would not allow me to edit the file directly so I went to notepad and made the change as requested and replaced the file in the original location. Now when I try to set up the testing demo I get some info tabs about something being outdated and asking me to define glut !!
I tried running the classic console program "Hello World" (with both versions of glut.cbp) and still get the message :  ld.exe cannot find -lfreeglut32.
If you have any further advice it will be appreciated. Many thanks.

Your only mentioning that you edited "glut.cbp". What about the other file I mentioned in my tutorial ?

Also, you do not use C::B to edit those file in my tutorial. I had even mentioned in my tutorial to use Windows Notepad as its the safest and easiest way to do it. You could even copy and paste the two files I listed because those 2 on that page are already edited.

What I find interesting is you said you got it running. So now i'm confused what the problem is that your having.

Either way, Hope the info helps.
« Last Edit: December 05, 2011, 06:27:06 am by JackDawson »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ld.exe cannot find -lfreeglut
« Reply #5 on: December 05, 2011, 06:33:50 am »
Yes I have read your instructions - 2 weeks ago I had that demo program running. So, I decided to start from scratch following your instructions as carefully as possible. All seemed to go well until I tried to edit the glut.cbp file. CB would not allow me to edit the file directly so I went to notepad and made the change as requested and replaced the file in the original location. Now when I try to set up the testing demo I get some info tabs about something being outdated and asking me to define glut !!
I tried running the classic console program "Hello World" (with both versions of glut.cbp) and still get the message :  ld.exe cannot find -lfreeglut32.
If you have any further advice it will be appreciated. Many thanks.
Never, never, never edit a projectfile directly, until you know exactly what you do !

Every advice to do so is bullshit !!

If you want to change the name of a linklibrary do it in the projects "Build options".

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #6 on: December 05, 2011, 06:40:32 am »
Yes I have read your instructions - 2 weeks ago I had that demo program running. So, I decided to start from scratch following your instructions as carefully as possible. All seemed to go well until I tried to edit the glut.cbp file. CB would not allow me to edit the file directly so I went to notepad and made the change as requested and replaced the file in the original location. Now when I try to set up the testing demo I get some info tabs about something being outdated and asking me to define glut !!
I tried running the classic console program "Hello World" (with both versions of glut.cbp) and still get the message :  ld.exe cannot find -lfreeglut32.
If you have any further advice it will be appreciated. Many thanks.
Never, never, never edit a projectfile directly, until you know exactly what you do !

Every advice to do so is bullshit !!

If you want to change the name of a linklibrary do it in the projects "Build options".

@ Jens
If you read the tutorial, you'll see why he has to edit two files directly. I was asked by several others to make this tutorial since most could not get regular Glut to work since it was outdated. So I was asked to make a Tutorial to set it up for freeGlut. So yes, he has to edit those two files directly for this to work with freeGlut.

Beings that your an admin, figured I better show you proof that I was asked to do it, and I didn't want you banning me for something I was asked to do. Even the Developer approved this : http://forums.codeblocks.org/index.php/topic,14967.0.html

And the tutorial has been referenced here and there by others. Here is one example : http://forums.codeblocks.org/index.php/topic,15313.0.html

« Last Edit: December 05, 2011, 07:07:35 am by JackDawson »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13318
    • Travis build status
Re: ld.exe cannot find -lfreeglut
« Reply #7 on: December 05, 2011, 11:28:24 am »
@JackDawson:
The replacement of glut with freeglut can be done in the gui, too, so Jens is generally right.
Also, why do you need the glut.cbp file? As far as I can see, the project file is generated
by the wizard script and glut.cbp is not mentioned in it!

p.s. Jens is not only admin, but a developer!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #8 on: December 05, 2011, 02:24:24 pm »
@JackDawson:
The replacement of glut with freeglut can be done in the gui, too, so Jens is generally right.
Also, why do you need the glut.cbp file? As far as I can see, the project file is generated
by the wizard script and glut.cbp is not mentioned in it!

p.s. Jens is not only admin, but a developer!

Yes it is mentioned. Look at the tutorial again.

According to his profile here on this thread it just says Admin. So I had no other way of knowing. It shows you as a developer, not him.

As far as editing it inside the GUI, I would have to do it for EVERY PROJECT and the thing is, why would you ? You see you use either Glut OR freeGlut, but you would never use both. Because lets face it, the whole purpose of freeGlut is to replace the old Glut. So you would edit the file as I have shown in the tutorials.

If you guys would actually READ my tutorial you would understand all this and know that there are TWO files that you have to edit.
« Last Edit: December 05, 2011, 02:30:03 pm by JackDawson »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13318
    • Travis build status
Re: ld.exe cannot find -lfreeglut
« Reply #9 on: December 05, 2011, 02:39:32 pm »
I've read your tutorial or glanced at it!

Can you tell me why glut.cbp is needed?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #10 on: December 05, 2011, 02:45:36 pm »
I've read your tutorial or glanced at it!

Can you tell me why glut.cbp is needed?

Yes if you open up your C::B and then click create new project, it will show up all those pretty icons. One of the ICONS is Glut. That is actually talking to your Wizard File. Its what sets up your first perimeters when your creating the project. The Glut.cbp file is whats sets up your libraries for your project. Without that file, your project becomes an empty project. You need that Glut.cbp to point your dependencies to the right libraries.

EXAMPLE : Create a new project with Glut. Then in the folder where you saved your project, is where that file gets renamed too. So lets say you named your project BUBBA. Well in that folder you saved it too, it saved a file in there named BUBBA.cbp. Well that Glut.cbp info is in there. The reason again is because its telling the IDE what dependencies your using. Glut.cbp is just a template file that gets renamed into each project.
« Last Edit: December 05, 2011, 02:49:31 pm by JackDawson »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13318
    • Travis build status
Re: ld.exe cannot find -lfreeglut
« Reply #11 on: December 05, 2011, 03:26:15 pm »
It doesn't work at all on linux, so I can really test it.
But I don't have glut.cbp on my hard drive.

But Jens is still right in his comment. And your tutorial shouldn't have been written but a patch for glut's template should have been made!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #12 on: December 05, 2011, 03:29:34 pm »
It doesn't work at all on linux, so I can really test it.
But I don't have glut.cbp on my hard drive.

But Jens is still right in his comment. And your tutorial shouldn't have been written but a patch for glut's template should have been made!

Hahaha your the one who encouraged me to make the tutorial.. LMAO

As for it to be a default, I TOTALLY agree, there should be a Glut and a FreeGlut option. But there is not. Its why the tutorial was made in the first place.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13318
    • Travis build status
Re: ld.exe cannot find -lfreeglut
« Reply #13 on: December 05, 2011, 03:58:04 pm »
Hahaha your the one who encouraged me to make the tutorial.. LMAO
Link or it didn't happen? As far as I can see, I've only told you how to login in the wiki.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: ld.exe cannot find -lfreeglut
« Reply #14 on: December 05, 2011, 04:47:40 pm »
@JackDawson.
Yes I did edit the other file (with notepad) – no problems. I don’t quite understand why I can’t edit a cbp file in CB editor however, I did edit the glut.cbp in notepad as you suggest. Now when I try to open glut.cbp using CB I get : SCR1
Now if I press O.K. I get: SCR2
 
Finally , I cannot close this except by pressing  CntrlAltDel and using the task manager.
If instead of messing with the above I try the simple console program “Hello World” I’m back to the error message that I started this thread with.
Don’t know if any of this helps – but I do appreciate the input.


[attachment deleted by admin]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ld.exe cannot find -lfreeglut
« Reply #15 on: December 05, 2011, 09:42:29 pm »
@JackDawson.
Yes I did edit the other file (with notepad) – no problems. I don’t quite understand why I can’t edit a cbp file in CB editor however, I did edit the glut.cbp in notepad as you suggest. Now when I try to open glut.cbp using CB I get : SCR1
Now if I press O.K. I get: SCR2
 
Finally , I cannot close this except by pressing  CntrlAltDel and using the task manager.
If instead of messing with the above I try the simple console program “Hello World” I’m back to the error message that I started this thread with.
Don’t know if any of this helps – but I do appreciate the input.

I think you did not really read the tutorial.
It tells you how to modify the glut-template, so it uses freeglut instead of glut.

You should not open the templates cbp-file directly, but create a (free)glut-project with the wizard, that ues the edited cbp-file.

By the way:
you can open a cbp-file (Code::Blocks projectfile) in C::B's editor if you use a recent version (aka nightly build) and open it via the FileManager plugin.
The normal way for C::B is to read the content of a cbp-file and open the project accordingly.

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #16 on: December 05, 2011, 09:59:07 pm »
Hahaha your the one who encouraged me to make the tutorial.. LMAO
Link or it didn't happen? As far as I can see, I've only told you how to login in the wiki.

http://forums.codeblocks.org/index.php/topic,14967.0.html


This is the link. As I said you encouraged me along with Olly. However if you only "Glanced" at that thread at the time it was being written, I can see why you would think you were only helping with the Wiki. However the way it came across on that thread you were encouraging me to write it as well since that was the Gist of the conversation during that time.

Your killing me with this Glance stuff bro.. lol

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #17 on: December 05, 2011, 10:02:12 pm »
@JackDawson.
Yes I did edit the other file (with notepad) – no problems. I don’t quite understand why I can’t edit a cbp file in CB editor however, I did edit the glut.cbp in notepad as you suggest. Now when I try to open glut.cbp using CB I get : SCR1
Now if I press O.K. I get: SCR2
 
Finally , I cannot close this except by pressing  CntrlAltDel and using the task manager.
If instead of messing with the above I try the simple console program “Hello World” I’m back to the error message that I started this thread with.
Don’t know if any of this helps – but I do appreciate the input.


I am going to repeat one line you said :

"I don’t quite understand why I can’t edit a cbp file in CB editor however"

I never said edit it in CB. As my tutorial states, you have to use notepad. And you edit both files using notepad.


EDIT : Jens mention something that might be of interest to you :

"You can open a cbp-file (Code::Blocks projectfile) in C::B's editor if you use a recent version (aka nightly build) and open it via the FileManager plugin."
« Last Edit: December 05, 2011, 10:07:10 pm by JackDawson »

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: ld.exe cannot find -lfreeglut
« Reply #18 on: December 05, 2011, 10:04:11 pm »
@JackDawson.
Yes I did edit the other file (with notepad) – no problems. I don’t quite understand why I can’t edit a cbp file in CB editor however, I did edit the glut.cbp in notepad as you suggest. Now when I try to open glut.cbp using CB I get : SCR1
Now if I press O.K. I get: SCR2
 
Finally , I cannot close this except by pressing  CntrlAltDel and using the task manager.
If instead of messing with the above I try the simple console program “Hello World” I’m back to the error message that I started this thread with.
Don’t know if any of this helps – but I do appreciate the input.

I think you did not really read the tutorial.
It tells you how to modify the glut-template, so it uses freeglut instead of glut.

You should not open the templates cbp-file directly, but create a (free)glut-project with the wizard, that ues the edited cbp-file.

By the way:
you can open a cbp-file (Code::Blocks projectfile) in C::B's editor if you use a recent version (aka nightly build) and open it via the FileManager plugin.
The normal way for C::B is to read the content of a cbp-file and open the project accordingly.


You the MAN !! Thank you. I am looking forward to see the Extra Option of FreeGlut in the ICON list. Both the Glut and FreeGlut should be there. I totally agree. I will be looking forward to that in a future version. Thank you thank you thank you.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13318
    • Travis build status
Re: ld.exe cannot find -lfreeglut
« Reply #19 on: December 05, 2011, 10:48:44 pm »
JackDawson:
Hm, I don't think Jens is going to add freeglut template to C::B.
Why do you think he is going to do so?
I've re-read his post couple of times and there is nothing mentioned about that.

If you want us to add the template, you should provide a patch against HEAD of trunk!

p.s. Please don't quote the whole previous message, including the quote. The idea of quoting is to highlight a part of the message you're answering to.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: ld.exe cannot find -lfreeglut
« Reply #20 on: December 06, 2011, 02:06:19 am »
@JackDawson

I appear to have misled you. I did not edit either file using CB but used notepad as you suggested.
Here are excerpts copied from my files as modified:
(1) The Wizard file:
// add link libraries
    if (PLATFORM == PLATFORM_MSW)
    {
        project.AddLinkLib(_T("freeglut"));      
        project.AddLinkLib(_T("opengl32"));
        project.AddLinkLib(_T("glu32"));
        project.AddLinkLib(_T("winmm"));
        project.AddLinkLib(_T("gdi32"));
    }
    else if (PLATFORM == PLATFORM_MAC)
(2) The glut.cbp file:
   <Add directory="$(#glut.include)" />
      </Compiler>
      <Linker>
         <Add library="freeglut" />
         <Add library="glu32" />
         <Add library="opengl32" />
         <Add library="winmm" />
         <Add library="gdi32" />
         <Add library="user32" />
         <Add library="kernel32" />
         <Add directory="$(#glut.lib)" />
      </Linker>
      <Unit filename="main.cpp">
Re my comment- of course one doen't edit a cbp file in CB one opens a cbp file and then can edit the source file cpp.
 However, my original problem remains. If I try to use the GLUT wizard to write a test program the compiler complains that it cannot locate glut32 and I cannot proceed. Again, if I try the console wizard I get the error message that started this thread.

Offline searcher

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: ld.exe cannot find -lfreeglut
« Reply #21 on: December 06, 2011, 10:35:35 pm »
@JackDawson.
Well it looks as if I'm back in business although I'm not totally sure why !!
Step (1): Changed the Global Settings , Other Settings, compiler loging entry to Full...
              This enabled Console applications to compile and run. However, the testing program still would not work for glut application. Message came up to the effect that path seemed to be correct but still could not find glut32.lib .

Step (2): Downloaded the glut32.lib and put it in the MinGW\lib directory and everything works !

Seems to me that the wizard is still not updated fully OR perhaps the demo program needs to be updated ??
Anyway thanks to all who tried to help - now I can return to learning modern openGL programming.

Offline Hesam

  • Single posting newcomer
  • *
  • Posts: 4
Re: ld.exe cannot find -lfreeglut
« Reply #22 on: July 22, 2012, 01:41:36 pm »
Hi Jack
I read your tutorial carefully when I run the sample GLUT project I get this error:
ld.exe cannot find -lfreeglut

I am using C::B 10.05, freeglut freeglut-MinGW-2.8.0-1, Windows7 64bit on DELL laptop with NVIDIA GeForce GT525M graphic card.

I have also did these:
1. Download this version (codeblocks-10.05-setup.exe)
2. Download this file(tdm64-gcc-4.6.1.exe)
3. check this settings in Compiler setting:
    C complier:                    x86_64-w64-mingw32-gcc.exe
    C++ complier:                 x86_64-w64-mingw32-g++.exe
    Linker for dynamic libs:     x86_64-w64-mingw32-g++.exe

Please advise

Offline zoznam0

  • Single posting newcomer
  • *
  • Posts: 1
Re: ld.exe cannot find -lfreeglut
« Reply #23 on: May 30, 2021, 07:42:32 am »
https://sourceforge.net/projects/codeblocks/files/Binaries/20.03/Windows/codeblocks-20.03mingw-nosetup.exe
https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MinGW.zip
https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MSVC.zip

On Win10 64bit. Unzip CB. With MinGW. Put header files from freeglut package under mingw/include. Put libraries from freeglut package under mingw/lib. I suppose the 64bit versions are relevant on a 64bit system. Put the 64bit version of freeglut.dll (from the bin directory of the package) under c:\windows\syswow64, so its available systemwide. Edit the project and wizard scripts for 'glut' project of CB. Specify the mingw subdirectory as the location for freeglut, once intending to create a project and asked to do so by the CB project wizard. However: cannot find -lfreeglut (still).
To the point: put 'lib/freeglut.lib' from the _MSVC_ package under 'mingw/lib' and the linker error will go away.

Seems mingw's library builds do not taste for gcc ? Packages messed up ? Is the mingw library not compatible with the msvc one ?

P.S. I know it's outdated topic, but that was the newest info on howto opengl under windows and those r my conclusions/questions. Regards.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7131
    • My Best Post
Re: ld.exe cannot find -lfreeglut
« Reply #24 on: May 30, 2021, 05:39:33 pm »
Please do not post to old threads!

Please do not tell someone to put files under the compiler installation folder!
It is not wise or smart thing to do.

Please learn how to use Code::Blocks global variables to point to folders that contain third party libraries.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org