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 ...
随机推荐
- jQuery自己定义绑定的魔法升级版
jQuery自己定义绑定 首先让我们来看看jQuery的自己定义绑定的用法,你能够使用bind或者live来订阅一个事件(当然1.7以后也能够使用on了),代码例如以下: $("#myEle ...
- 在centos中安装jenkins master为service
需要sudo或root权限. 翻译自: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+dis ...
- Reactor与Proactor比较
from http://www.cnblogs.com/dawen/archive/2011/05/18/2050358.html 1.标准定义 两种I/O多路复用模式:Reactor和Proacto ...
- 我所经历的SAP选型[转]
这是一个失败的选型项目,而且在可遇见的未来公司也不会再经历SAP选型,甚至不会再启动erp项目,个中原因很难一言道尽,在此简要的说说我们的选型过程以及在选型过程中对各种因素的考虑. 一.重启选型工作七 ...
- C#中泛型容器Stack<T>的用法,以及借此实现”撤销/重做”功能
.Net为我们提供了众多的泛型集合.比如,Stack<T>先进后出,Queue<T>先进先出,List<T>集合元素可排序,支持索引,LinkedList<T ...
- 排名前16的Java工具类
原文:https://www.jianshu.com/p/9e937d178203 在Java中,工具类定义了一组公共方法,这篇文章将介绍Java中使用最频繁及最通用的Java工具类.以下工具类.方法 ...
- Java io.netty.util.ReferenceCountUtil 代码实例
原文:https://www.helplib.com/Java_API_Classes/article_64580 以下是展示如何使用io.netty.util.ReferenceCountUtil的 ...
- C#编程(四十九)----------队列
队列 1.Queue定义 System.Collections.Queue类表示对象的先进先出集合,存储在Queue(队列)中的对象在一端插入,从另一端移除. 2.优点 (1).能对集合进行顺序处理( ...
- 【nginx】配置Nginx实现负载均衡
一文中已经提到,企业在解决高并发问题时,一般有两个方向的处理策略,软件.硬件,硬件上添加负载均衡器分发大量请求,软件上可在高并发瓶颈处:数据库+web服务器两处添加解决方案,其中web服务器前面一层最 ...
- window消息机制
剖析Windows消息处理机制 前一段,帮人写了个小控件,又温习了一遍Windows消息处理机制,现在把一些知识点总结出来,供大家参考.1.窗口 Windows程序是由一系列的窗口构成的,每个窗 ...