Author Topic: Freeglut with code blocks  (Read 5811 times)

Offline chihwahli

  • Single posting newcomer
  • *
  • Posts: 5
Freeglut with code blocks
« on: May 10, 2013, 10:11:38 am »
I have been trying to get the first Opengl super-bible version 4 exercise working in Code blocks 12.11.
I think I am very close. The thread is long, it's located in another forum, and thought, wait a minute, maybe I did smething wrong in Code blocks, who to better ask than HERE?!

http://www.cplusplus.com/forum/general/101665/

I guess it's better to paste the link instead copying all thread info back into Code blocks forum....
Been trying real hard to solve the problem myself as you can see, I know you guys have been answering the same question over and over again... If I have the answer. I don't mind typing one code blocks 12.x openGL with Freeglut tutorial for windows 7...
Then sticky in on top and direct people towards there....

Offline koonschi

  • Multiple posting newcomer
  • *
  • Posts: 27
    • My personal project
Re: Freeglut with code blocks
« Reply #1 on: May 10, 2013, 12:05:19 pm »
Hey,
Reading the other topic made me slightly confused :D

What I can tell you is, how to decipher those errors:

"XXX was not declared in this scope"
The compiler simply can't find XXX, it doesn't even know about its existance.
Reason:
Maybe an undeclared function or variable.
Fix:
Usually including the right headers, using the correct namespace or simply declaring the function.


"undefined reference to XXX"
The compiler found a declaration of a function, but not the implementation.
Reason:
You declared it somewhere, but missed implementing it.
You did not link the library where the function is defined.

Fix:
If you made that function, implement it.
If it's from a library, In the build options of you project, in 'Linker settings' add the correct libaries to the list. I already came across cases where the order of those libraries is important, so you might try that out too.

"ld.exe: cannot find -lXXX"
Reason:
You told the linker to link a certain library, but it can't find it.

Fix:
In the build options of you project, in 'Search Directories' -> 'Linker' add the correct directories where your libs are located to the list.


If gcc can't find headers, you need to tell it where they are (in project -> build options -> search directories -> compiler)
This is similar to the lib directories.


What usually suffices to build a project with libs is to
- specify where your headers lie (in project -> build options -> search directories -> compiler)
- specify where your libs lie (in project -> build options -> search directories -> linker)
- add the libs you want to link to to the linker settings' list (in project -> build options -> linker settings)


Hope to help,

Koonschi
"As a general rule, the compiler is smarter than you, and working in your best interest. Do not question it." - Terry Mahaffey

#define TRUE FALSE // happy debugging suckers

Offline chihwahli

  • Single posting newcomer
  • *
  • Posts: 5
Re: Freeglut with code blocks
« Reply #2 on: May 10, 2013, 07:27:21 pm »
Thanks Koonschi for taking the effort of reading!   :) And I thought I wrote my trials very stepwise....  :-\

I tried that, I kee getting the same errors. Perhaps if someone gave me the correct files and, then at least I know the source
files areall working and correct...

Someone must have a working IDE (opensource) enviroment.... (althought I read that sometimes 7/10 example progs don't work at all)