Can't include <gl/gl.h>

落花浮王杯 提交于 2019-12-03 23:21:40

Just do an include of windows.h first.

#include <windows.h>

As it's said in the OpenGL FAQ :

Also, note that you'll need to put an #include <windows.h> statement before the #include<GL/gl.h>. Microsoft requires system DLLs to use a specific calling convention that isn't the default calling convention for most Win32 C compilers, so they've annotated the OpenGL calls in gl.h with some macros that expand to nonstandard C syntax. This causes Microsoft's C compilers to use the system calling convention. One of the include files included by windows.h defines the macros.


Resources :

Edit: Obviously Colin Hebert solved the problem, but as a general tip I`d like to say:

In Camera.h write

#ifndef _CAMERA_H
#define _CAMERA_H

above all other includes. And include all header files needed in your .cpp file in your .h file.

At least that`s what I think is best practice.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!