Jan3Sobieski
Jan3Sobieski

Reputation: 275

C++ OpenGL, errors when linking, compiling

I can't move on with errors from linker, or compiler. I want to compile my old projects, but I can't cope with errors. in folder with source.cpp I have also

open32.dll 
glu32.dll 

glut32.dll (i download it) 
glut.h (si download it) 
glut.lib (i download it) 
glut.def (i think its not nessesery)

bach looks like

path %pathC:\MinGW\bin 
g++ -o program.exe main.cpp glut32.lib 

and I get errors in every line where I use function from glut32.dll/opengl.dll, all errors are similar C:\Users\Przemko\AppData\Local\Temp\cc4n2CuY.o:main.cpp:(.text+0xe5): undefined reference to `glClearColor@16'

In MinGW\Include I have folder GL with headers:

glu.h 
gl.h 
glext.h

"i get it while installing MingW"

my source include

#include <time.h>
#include <iostream>
#include <math.h>
#include <windows.h>
#include "glut.h"

I need help, I don't remember how to link every item, I wish I have my old bash and library, but I don't.

Upvotes: -1

Views: 774

Answers (2)

Rohit Pruthi
Rohit Pruthi

Reputation: 79

You might want to keep your dll files in SysWOW64 folder instead of System32 folder in case you have x64 libraries.

Upvotes: 0

Some programmer dude
Some programmer dude

Reputation: 409472

You don't link with the actual OpenGL library, you need to add -lGL to your command:

$ g++ -o program.exe main.cpp glut32.lib -lGL

Upvotes: 3

Related Questions