gera
gera

Reputation: 1

Why do I get this error when I compile a C++ program in jgrasp?

----jGRASP exec: gcc -g -o C1.exe C1.c -lglu32 -lfreeglut -lopengl32`

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lfreeglut
collect2.exe: error: ld returned 1 exit status

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

I am using mingw32 compiler and I followed the instructions from the link below: http://users.csc.calpoly.edu/~akeen/courses/csc101/references/gcc.html Hope that someone knows what to do thank you

Upvotes: 0

Views: 1307

Answers (1)

vsoftco
vsoftco

Reputation: 56557

You probably need to specify the location of the freeglut library with the flag -L /path/to/freeglut, so compile as

gcc -g -o C1.exe C1.c -L/path/to/freeglut -lglu32 -lfreeglut -lopengl32

or, if you use an IDE, there should be an option to specify the location of the libraries used by the linker.

See http://users.csc.calpoly.edu/~phatalsk/references/jGrasp_gcc_Setup/GCC_JGrasp_Install.html

Settings/Compiler Settings/Workspace, add the flag to C/L field.

Upvotes: 1

Related Questions