gl.h included before glew.h
So I'm trying to move my OpenGL code from Main() into a specific class that will handle the 3D graphics only when necessary. Previously, the top of my main.cpp file looked like this:
#define GLEW_STATIC
#include
<GL/glew.h>
#include
<SFML/Graphics.hpp>
#include
<cstdlib>
#include
<iostream>
#include
<fstream>
#include
"Game.h"
This worked well enough. What I tried to do was move all the OpenGL-relevant code into methods of the Game class. So I removed #define GLEW_STATIC and #include <GL/glew.h> from the above, and put them into Game.h, such that the top of Game.h now looks like this:
#define GLEW_STATIC
#include
<GL/glew.h>
#include
<SFML/Graphics.hpp>
#include
<cstdlib>
#include
<iostream>
#include
<fstream>
#include
"Environment.h"
When I try to compile, I get the title error, #error gl.h included before glew.h.
Why is this happening, and how can I use OpenGL code (almost) entirely inside the functions of a specific class without this happening?
EDIT:
I have also tried this configuration in main.cpp, in an attempt to make sure that nothing includes SFML before GLEW.
#include
<cstdlib>
#include
<iostream>
#include
<fstream>
#include
"Game.h"
#include
<SFML/Graphics.hpp>
Unfortunately, that doesn't help (there's nothing else being included that I'm not mentioning here).
[答案]
Some other library is including gl.h. My guess would be SFML. Make sure you include GLEW first in Game.h and check the places where you include Game.h to make sure you're not including SFML or something else that includes gl.h before Game.h.
If you have something like:
#include
<something_that_includes_gl.h>
#include
"Game.h"
It will effectively include gl.h before GLEW.
我的情况是在andriod ndk项目中遇到的这个错误,把
#include
<GL/glew.h>
这句话放在pch.h的最前面,错误就没有了。
gl.h included before glew.h的更多相关文章
- C++中#include包含头文件带 .h 和不带 .h 的区别
C++中#include包含头文件带 .h 和不带 .h 的区别? 如 #include <iostream> 和 #include <iostream.h> 包含的东西有哪些 ...
- sed命令查找<media/msm_cam_sensor.h>替换为"len_msm_cam_sensor.h"
sed -i 's:<media/msm_cam_sensor.h>:"len_msm_cam_sensor.h":g' $(find . -name "*. ...
- H.264 RTPpayload 格式------ H.264 视频 RTP 负载格式
H.264 RTPpayload 格式------ H.264 视频 RTP 负载格式 1. 网络抽象层单元类型 (NALU) NALU 头由一个字节组成, 它的语法如下: +------------ ...
- H.264 SVC 与H.264 AVC
分级视频编码技术实现一次性编码产生具有不同帧率.分辨率的视频压缩码流,然后根据不同网络带宽.不同的显示屏幕和终端解码能力选择需要传输的视频信息量,以此实现视频质量的自适应调整 AVC 实际上是 H.2 ...
- mysql -h localhost和mysql -h 127.0.0.1的区别
今天早上同事说MySQL root账号登录不上了.我试了一下 #mysql -u root -p 提示”Access denied for user ‘root’@’localhost’ (using ...
- H.264 RTPpayload 格式------ H.264 视频 RTP 负载格式(包含AAC部分解析)
H.264 RTPpayload 格式------ H.264 视频 RTP 负载格式 1. 网络抽象层单元类型 (NALU) NALU 头由一个字节组成, 它的语法如下: +------------ ...
- 简单地迁移你的android jni代码逻辑到iOS - 编写iOS下jni.h的替代 - ocni.h
1. jni的代码逻辑中与上层平台语言交互了. 2. 使用非Xcode的ide开发工具,希望使用纯净的c/c++代码,不掺杂其它平台相关的语言语法. 3. 只想简单地替换jni代码对上层平台语言的功能 ...
- H.265 HD 和H.265 4K Video Encoder IP Core
H.265 HD 和H.265 4K Video Encoder IP Core H.265 HD Video Encoder IP Core(H.265 HD Video/Audio Encoder ...
- sed初理多行合并+sed之G、H、g、h使用+sed n/N使用说明
转载:[shell]sed处理多行合并 - seyjs - 博客园 (cnblogs.com) 文件格式 table=t1 name owner address table=t2 id text co ...
随机推荐
- word删除空白行
情况一:如果粘贴后,word页面既有表格又有文字(有时网页中选定时看不到表格,粘贴后却有表格),还有许多空行! 硬回车: “编辑--替换” -查找内容为“^p^p”,替换成“^p”--然后全部替换! ...
- 使用GSON和泛型解析约定格式的JSON串(转)
时间紧张,先记一笔,后续优化与完善. 解决的问题: 使用GSON和泛型解析约定格式的JSON串. 背景介绍: 1.使用GSON来进行JSON串与java代码的互相转换. 2.JSON的格式如下三种: ...
- HDU 4821 String(2013长春现场赛I题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4821 字符串题. 现场使用字符串HASH乱搞的. 枚举开头! #include <stdio.h ...
- NXP ARM Vector Table CheckSum
Signature Creator for NXP Cortex-M Devices Algorithm for creating the checksum The reserved Cortex-M ...
- 清华梦的粉碎—写给清华大学的退学申请(转自王垠Blog)
清华梦的诞生 小时候,妈妈给我一个梦.她指着一个大哥哥的照片对我说,这是爸爸的学生,他考上了清华大学,他是我们中学的骄傲.长大后,你也要进入清华大学读书,为我们家争光.我不知道清华是什么样子,但是我知 ...
- cocos2d-x基本元素
from://http://www.cnblogs.com/ArmyShen/p/3239664.html 1.CCDirector(导演类) 控制游戏流程的主要类,主要负责设定游戏窗口.切换场景.暂 ...
- 加州靡情第一至七季/全集Californication迅雷下载
加州靡情 第一至七季 Californication Season 1-7 (2007-2014)本季看点:2007-2014,7季,84集.电视圈一直有个怪现象,有许多演员在非常成功剧集完结之后,反 ...
- 广告狂人第一至七季/全集Mad Men迅雷下载
广告狂人 第一季 Mad Men Season 1 (2007) 本季看点:你是谁?你想要什么?你爱乾什么?这些都不重要,重要的是你怎么把东西卖出去.凡是了解纽约的人都知道,今天,在麦迪逊大道(Mad ...
- 摩登家庭第一季/全集Modern Family迅雷下载
本季Modern Family Season 1 第一季(2009)看点:<摩登家庭>瞄准的是三对各有不同的美国家庭:一对普通父母与三个孩子.一对同性恋夫夫从越南领养了养女组成三口之家,一 ...
- CSS3 Flex布局整理(二)-容器属性
一.Flex容器属性介绍 1.flex-flow :水平或垂直方向上的流动方式,包裹处理,其中包括了flex-direction属性和flex-wrap属性. 2.justify-content:定义 ...