简体   繁体   中英

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.

#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:
Error 1 error C2008: '$': unexpected in macro definition C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h 142

Please check that you didn't disable Microsoft C++ extensions. $ as a part of identifiers is a part of these extensions, so driverspecs.h won't compile when they are disabled. Command line switch is /Za, also this option is the top-most in Language section in project properties in Visual Studio

My first guess would be windows.h stuff conflicting with opengl definitions. You don't really need windows.h for a simple command line application like this one. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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