I'm trying to run a GLSL example, but I can't.
The error is in the line glGetShaderiv(vShader, GL_COMPILE_STATUS, &status);
where the program exits. vShader
is the file vPhong.glsl
.
The error returned is:
0(18) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
0(18) : error C0501: type name expected at token "<undefined>"
I have 'installed' and referenced GLEW and Glut and their lib-files. I have glewInit
'ed my program.
The program is able to find the .glsl-files.
The weird thing is that I am able to run a precompiled GLSL-demo, and also compile and run the project on my pc. The "initializations" in the non-working program and this are the same.
I have tried copying the defective source into the successful project, to see if there was something in the project settings causing the error, but unfortunately, that wasn't the case. So the error seems to be in the C++ code, not the project.
PROGRESS:
On my Windows 7-machine i got "Access violation" when running through Visual Studio. The program just stopped working if I ran it "alone". On a Windows XP-machine I got an uncaught exception.
I received no errors or warnings (apart from a warning that fopen
is unsafe) when I compiled the program.
Visual Studio highlighted the line vShader = glCreateShader(GL_VERTEX_SHADER);
as the source of the error.
Adding glewInit();
fixed the above errors.