Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
i'm trying to compile a program on codeblocks
and i had the above error don't know what to do any help!!??
Updated 19-May-20 21:03pm
Sandeep Mewara 11-May-12 0:45am    
You need to add more information like what were you trying to do? Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.

You're probably missing a reference to the glut library.
In Windows, the library file is called glut32.lib.
Not sure what the name is on other OSs.
Share this answer
Further to <<_Superman_>>'s suggestion - since you're using Code::Blocks on Windows, your most likely compiler chain is MinGW. The library name given above is the one that's relevant when using Microsoft compilers.

To use llibGlut32.a as it's known,
  • Goto Project->Build Options
  • Select the top option in the tree on the left - it'll be your project name (don't selct Release or Debug, since that will only add the library to either one of the build configurations. The top option (of which they're both children) will add the library to both)
  • Select Linker Settings
  • Hit Add
  • Type glut32
  • Hit Alt-O (Or click the Okay button)

Adding libraries in this manner allows you to ommit the .a extension, as does it free you from having to type lib first. If you look into the default lib folder for CodeBlocks (C:\Program Files (x86)\CodeBlocks\MinGW\lib) you'll see that all of the lib files have the .a extension and start with lib

If, on the other hand you hit the browse button to add the lib name - you'll find either a full or relative path is crafted to the file, and that it's the full name in full.

You also need to add a library manually if you get some Visual Studio code that uses #pragma import "libraryName" as a means of adding a library, since GCC doesn't accept this preprocessor directive.
Share this answer
Emin Kültürel_1 18-Jan-23 23:37pm    
Thanks for the tip. It worked.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900