Hello all,
I was having issues with OpenGL in VC++, so I created the following simple test files and tested them under Dev-C++, which I previously had always used:
GLClass.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#ifndef MY_GL_CLASS_H
#define MY_GL_CLASS_H
#include <gl/gl.h>
class GLClass {
protected:
GLfloat f;
public:
GLClass(float value) : f(value) {}
GLfloat doSomeStuff() const;
};
#endif //MY_GL_CLASS_H
|
GLClass.cpp:
1 2 3 4 5 6 7 8 9 10
|
#include "GLClass.h"
GLfloat GLClass::doSomeStuff() const {
//Do some random pointless math
GLfloat x = f - 3.0f;
GLfloat y = f * 99.0f;
return x / y;
}
|
main.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
#include "GLClass.h"
using namespace std;
int main() {
GLClass myClass(1.0f);
cout << myClass.doSomeStuff();
cin.get();
return 0;
}
|
In Dev-C++, I simply add '-lopengl32' to linker command line options, under 'Compiler Options'.
In VC++, I added 'opengl32.lib', under Properties->ConfigurationProperties->Linker->Input->Additional Dependencies. Is that not the correct thing to do? I get a list of 143 errors, the first few of which are shown below:
error C2144: syntax error : 'void' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ';' before identifier 'glAccum'
error C2182: 'APIENTRY' : illegal use of type 'void'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2144: syntax error : 'void' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2086: 'int WINGDIAPI' : redefinition
I'm sure this is just something simple about VC++ that I don't properly understand. Any help is greatly appreciated!