简体   繁体   English

VS2010中的OpenGl

[英]OpenGl in VS2010

I'm trying to start learing opengl and I use VS2010 ultimate sp1 but when I add opengl headers I'm getting errors which indicate that there are errors in files not created by me.我正在尝试开始学习 opengl 并且我使用 VS2010 Ultimate sp1,但是当我添加 opengl 标头时,我收到错误,表明文件中存在错误不是由我创建的。

#include "stdafx.h"
#include <Windows.h>
#include <gl\GL.h>
#include <gl\GLU.h>

int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

errors (195 in total) this is I think the most common one:错误(总共 195 个)这是我认为最常见的错误:
Error 1 error C2008: '$': unexpected in macro definition C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h 142错误 1 错误 C2008:'$':宏定义中出现意外 C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h 142

Please check that you didn't disable Microsoft C++ extensions.请检查您是否没有禁用 Microsoft C++ 扩展。 $ as a part of identifiers is a part of these extensions, so driverspecs.h won't compile when they are disabled. $ 作为标识符的一部分是这些扩展的一部分,因此 driverspecs.h 在它们被禁用时不会编译。 Command line switch is /Za, also this option is the top-most in Language section in project properties in Visual Studio命令行开关是 /Za,此选项也是 Visual Studio 项目属性中语言部分的最顶部

My first guess would be windows.h stuff conflicting with opengl definitions.我的第一个猜测是 windows.h 与 opengl 定义冲突的东西。 You don't really need windows.h for a simple command line application like this one.对于像这样的简单命令行应用程序,您并不真的需要 windows.h。 Another possibility is the precompiled headers option (stdafx.h) I usually disable it in the compiler options when I deal with OpenGL and other cross platform projects as dependencies they bring in usually don't agree well with ported code另一种可能性是预编译头文件选项 (stdafx.h) 当我处理 OpenGL 和其他跨平台项目时,我通常在编译器选项中禁用它,因为它们带来的依赖项通常与移植代码不太一致

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM