.exe compiled with Visual C++ Express won't run

When I compile a Release version of my OpenGL program using Microsoft’s Visual C++ 2005 Express Edition, the .exe file that can be found in the /Release folder does not run and windows reports that the program has encountered a program and needs to close.

However, this problem ONLY occurs when I’m using shaders with GLEW, I can successfully compile GLEW-less OpenGL programs in release mode and run them without problems.

Anyone know what the problem might be? I can’t seem to figure it out and I figured that asking around here would be a good first step. I’m still new at this, and I’ve been using lighthouse3d.com as my primary resource for learning GLSL and getting stuff working.

if it helps, my current suspected problem is from the following compiler output line:
LINK : warning LNK4075: ignoring ‘/INCREMENTAL’ due to ‘/OPT:ICF’ specification

I still don’t understand what Linking is, either.

Linking is what happens when the compiler takes all compiled files and makes a .exe out of it. That warning just means it didn’t do an incremental linking because the options didn’t allow it, so it did a full link instead. For release you probably don’t want incremental linking anyway (since it bloats the .exe slightly over time unless you delete the .ilk file). This is most likely not related to your problem. I’d guess you simply didn’t probably initialize GLEW or you didn’t initialize it at the right point in your program. Initialize it after you’ve created your GL context.

Thanks a lot for explaining Linking, that helps a LOT. I managed to get rid of that linking error, but I still can’t get the .exe to run. I’ve narrowed down the problem to my glShaderSource() function calls. My compiled .exe works fine when the calls are commented out.

The strange thing that I can’t figure out is why it works when I run it from Visual C++ Express. Would it have anything to do with adding glew32.lib to the list of additional dependencies for the project? That was the only way I could compile the project.

Is glew used as static or dynamic library ? in the second case you must make sure the glew dll is present in the same directory as your .exe …

How can I tell whether or not glew is being used statically or dynamically? I installed all the glew .lib and .h files into my Visual C++ directory in the corresponding folders. Also, putting the .dll in the same directory doesn’t work, I’ve already tried that.

Thanks for your help!

I solved my problem, turns out that I needed to have the shader definition files in the same directory as my .exe.

Thanks for the help, though, your easy explanation of linking has helped me with other things!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.