Jump to content
  • Advertisement
Sign in to follow this  
nickme

VS2015 skipped reading glew.h file

This topic is 827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I setup the nuget.core 0.1.0.1 in my package manager, but unable to run the source files
 
Severity Code Description Project File Line Suppression State
Warning C4627 '#include <GL/glew.h>': skipped when looking for precompiled header use OpenGLtest d:\vs\opengltest\opengltest\opengltest.cpp 2
Severity Code Description Project File Line Suppression State
Warning C4627 '#include <GL/freeglut.h>': skipped when looking for precompiled header use OpenGLtest d:\vs\opengltest\opengltest\opengltest.cpp 3
Severity Code Description Project File Line Suppression State
Error C3861 'glutInit': identifier not found OpenGLtest d:\vs\opengltest\opengltest\opengltest.cpp 30
 
...
 
and can not run and generated all kind of opengl undeclared errors.
 
any help would be appreciated.
Edited by nickme

Share this post


Link to post
Share on other sites
Advertisement

You've got precompiled headers active. Turn it off in the options or include the glew headers in stdafx.h.

Thanks for your reply.  i am new to this vs2015, how do i turn it off in options?  in what menu?

 

but thank for your suggestion i got the program run when i include the glew header in stdafx.h.  but it seem like it is better to turn it off.

 

in a related note, the packages.config has packages undeclared, why is that?

 

thanks

Edited by nickme

Share this post


Link to post
Share on other sites

In VS 2013 to turn off precompiled headers, right-click on the project in Solution Explorer, choose Properties.The option ought to be under General-Properties->C/C++->Precompiled Headers.

 

Regarding undeclared packages, is there an exact message?

Share this post


Link to post
Share on other sites

In VS 2013 to turn off precompiled headers, right-click on the project in Solution Explorer, choose Properties.The option ought to be under General-Properties->C/C++->Precompiled Headers.

 

Regarding undeclared packages, is there an exact message?

thanks for the reply.

 

regarding undeclared packages element.  when i double clicks on the packages.config, it show that under the <packages> has squiggles line.  when i ignored it it compiled and ran.

i am just curious.

 

my compiler is VS 2015

Edited by nickme

Share this post


Link to post
Share on other sites

but thank for your suggestion i got the program run when i include the glew header in stdafx.h.  but it seem like it is better to turn it off.


Highly disagree. Precompiled headers are all but essential to optimize the compilation of a C++ codebase of non-trivial size.

If you're new to the VS toolchain, you should take a little time to learn about PCH's ans how to use them. In that vein, some advice:

1) You can change PCH properties in VS by right-clicking your project, selecting Properties, and then opening up the C/C++ -> Precompiled Headers section.
2) Keep them small. A PCH should only include headers if those headers are used in a very large percentage of your codebase. As your graphics code should be fairly localized, GLEW/GL does not count in general.
3) Put only infrequently-changing headers, like system headers or third-party dependencies, into PCH's. If any header used in a PCH changes, your entire project must be recompiled, which can slow down development. Only put your own headers into a PCH if they are very very common, very heavy/expensive, _and_ have a low rate of change.
5) Make them optional and test this occassionally (or in your CI system). The stock VS setup requires you to include stdafx.h into each source file. This means that if you ever want to test compilation without PCH's (which can be useful for build engineering) you're out of luck. Instead, use the VS properties to set the Forced Include File to your PCH header (under C/C++ -> Advanced). Then if you ever want to turn of PCH's, you also just turn off the forced include.
6) Call your header something else. "stdafx.h" is a legacy name that doesn't have meaning on other platforms like Linux or OSX, but PCH's are still very much relevant on those platforms. You can rename the PCH in VS on the Precompiled Headers property page.
7) Break your project into a logical chunks and use different PCH's for each. For instance, if your GL-based graphics code is split out cleanly from the rest of your code, and there's many graphics-related files, you _do_ want to put GLEW/GL into a PCH, but only the one used by the graphics code.
8) C++ Modules mostly obviate the need for PCH's, but modules are at least several years away from being stable or universally available to developers. I'd recommend reading up on them anyway, though.
9) Visual Studio requires a corresponding .cpp file for each PCH that causes the PCH to be compiled. Other compilers also require PCH compilation, but usually don't require a separate file to accomplish this. Be aware of how PCH's are built on other platforms.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!