我正在学习OpenGL三维教程,如下所示:http://www.arcsynthesis.org/gltut/index.html
我遵循了为构建教程编写的说明,但是当我在使用config=debug函数后使用MinGW的msys程序在OpenGL SDK目录中输入make时,就会出现一个编译器错误,即“intypes.h:没有这样的文件或目录”。
In file included from include/glload/gl_all.hpp:9,
from source/gl_load_cpp.cpp:4:
include/glload/_int_gl_exts.hpp:731: error: integer constant is too large for "l
ong" type
include/glload/_int_gl_exts.hpp:4322: error: GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4322: error: ISO C++ forbids declaration oftim
eout' with no type
include/glload/_int_gl_exts.hpp:4328: error: GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4328: error: ISO C++ forbids declaration oftim
eout' with no type
include/glload/_int_gl_exts.hpp:4355: error: GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4355: error: ISO C++ forbids declaration ofpar
ams' with no type
include/glload/_int_gl_exts.hpp:5273: error: ISO C++ forbids declaration of GLu
int64' with no type
include/glload/_int_gl_exts.hpp:5273: error: typedefgl::_detail::GLuint64' is
initialized (use typeof instead)
include/glload/_int_gl_exts.hpp:5273: error: Proc_glGetImageHandleARB' was not
declared in this scope
include/glload/_int_gl_exts.hpp:5273: error: expected,' or ;' before '(' toke
n
include/glload/_int_gl_exts.hpp:5276: error:GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:5276: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:5287: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:5287: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:5288: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:5288: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:5291: error: expected init-declarator before "Ge
tImageHandleARB"
include/glload/_int_gl_exts.hpp:5291: error: expected `,' or `;' before "GetImag
eHandleARB"
include/glload/_int_gl_exts.hpp:7879: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7879: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7880: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7880: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7883: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7883: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7883: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7883: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7884: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7884: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7887: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7887: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7887: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7887: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7887: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7887: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:7888: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7888: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7891: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7891: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7891: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7891: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7891: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7891: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7891: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:7891: error: ISO C++ forbids declaration of `w'
with no type
include/glload/_int_gl_exts.hpp:7892: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7892: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7895: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7895: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7896: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7896: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7899: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7899: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7899: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7899: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7900: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7900: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7903: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7903: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7903: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7903: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7903: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7903: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:7904: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7904: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:7907: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7907: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7907: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7907: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:7907: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:7907: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:7907: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:7907: error: ISO C++ forbids declaration of `w'
with no type
include/glload/_int_gl_exts.hpp:7908: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:7908: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8197: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8197: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:8199: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8199: error: ISO C++ forbids declaration of `min
PresentTime' with no type
include/glload/_int_gl_exts.hpp:8200: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8200: error: ISO C++ forbids declaration of `min
PresentTime' with no type
include/glload/_int_gl_exts.hpp:8261: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8261: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:8262: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8262: error: ISO C++ forbids declaration of `res
ult' with no type
include/glload/_int_gl_exts.hpp:8263: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8263: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:8264: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8264: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:8271: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8271: error: ISO C++ forbids declaration of `val
ue' with no type
include/glload/_int_gl_exts.hpp:8272: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8272: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8273: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8273: error: ISO C++ forbids declaration of `val
ue' with no type
include/glload/_int_gl_exts.hpp:8274: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8274: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8401: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8401: error: ISO C++ forbids declaration of `par
ams' with no type
include/glload/_int_gl_exts.hpp:8404: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8404: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:8405: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8405: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8408: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8408: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8408: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:8408: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:8409: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8409: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8412: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8412: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8412: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8412: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:8412: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:8412: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:8413: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8413: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8416: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8416: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8416: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8416: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8416: error: ISO C++ forbids declaration of `x'
with no type
include/glload/_int_gl_exts.hpp:8416: error: ISO C++ forbids declaration of `y'
with no type
include/glload/_int_gl_exts.hpp:8416: error: ISO C++ forbids declaration of `z'
with no type
include/glload/_int_gl_exts.hpp:8416: error: ISO C++ forbids declaration of `w'
with no type
include/glload/_int_gl_exts.hpp:8417: error: expected `,' or `...' before '*' to
ken
include/glload/_int_gl_exts.hpp:8417: error: ISO C++ forbids declaration of `GLu
int64EXT' with no type
include/glload/_int_gl_exts.hpp:8443: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8443: error: ISO C++ forbids declaration of `add
ress' with no type
include/glload/_int_gl_exts.hpp:8447: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8447: error: ISO C++ forbids declaration of `res
ult' with no type
include/glload/_int_gl_exts.hpp:8664: error: `GLuint64EXT' has not been declared
include/glload/_int_gl_exts.hpp:8664: error: ISO C++ forbids declaration of `cap
ture_time' with no type
source/gl_load_cpp.cpp:879: error: expected init-declarator before "_funcptr_glG
etImageHandleARB"
source/gl_load_cpp.cpp:879: error: expected `,' or `;' before "_funcptr_glGetIma
geHandleARB"
source/gl_load_cpp.cpp:4342: error: expected constructor, destructor, or type co
nversion before "GetImageHandleARB"
source/gl_load_cpp.cpp:4342: error: expected `,' or `;' before "GetImageHandleAR
B"
source/gl_load_cpp.cpp: In function `void gl::CopyFunctionPointers()':
source/gl_load_cpp.cpp:7624: error: `GetImageHandleARB' undeclared (first use th
is function)
source/gl_load_cpp.cpp:7624: error: (Each undeclared identifier is reported only
once for each function it appears in.)
source/gl_load_cpp.cpp:7624: error: `_funcptr_glGetImageHandleARB' undeclared (f
irst use this function)
make: *** [Debug/gl_load_cpp.o] Error 1
</code></pre>我目前正在使用MinGW来编译它,我必须同时使用Windows命令提示符和MSYS来使其工作。
发布于 2015-01-04 11:26:38
使用更新后的版本,在这里下载一个包:
MinGW构建
用于编译的工具(makefile、cmake、任何IDE),您必须让它知道C/C++编译器在哪里。
为此,我使用脚本设置环境变量(比看起来更容易),这样就不会污染“全局环境”:
下面是批处理文件,它允许您使用命令行命令(如"g++ -bla“)
set "PATH=D:/MinGWBuilds/mingw32/bin;C:/Windows/System32;"
set "CC=D:/MinGWBuilds/mingw32/bin/gcc"
set "CXX=D:/MinGWBuilds/mingw32/bin/g++"
set DXSDK_DIR="D:/MinGWBuilds/mingw32/i686-w64-mingw32/include/ddkv"
cd /d "%~dp0"
cmd.exe您只需从控制台启动ide (操作简单,而不是调用"cmd.exe“,您可以调用"CodeBlocks.exe”或任何其他Ide/文本编辑器/脚本运行程序,只需将其路径添加到path中即可)。
当然,您必须为缺少的程序添加路径,如python/lua解释器等。不要因为使用Env变量和命令提示符而责怪我,这确实会使您的生活变得更加轻松,一旦您获得了所有需要的脚本。例如,我使用它与CMake一起完成几乎所有事情(使用各种编译器版本交叉编译Win、Mac、Linux、Android等,因为我维护了一个库,我在开发时也生成VS项目文件,以便在为Linux :d编译时使用VS的很好的完成特性)。
请注意,我不再使用MSYS或MSYS2。我只使用由Cmake生成的makefiles。以及mingw32/bin文件夹中的make可执行文件(mingw32-make.exe)
哦,请记住,您需要使用以下编译标志启用c++11
-std=c++11
在此之后,您可以自由地包含cinttypes。
发布于 2015-02-10 22:05:43
您似乎使用了错误的环境/ GCC编译器。在这句话中,您说您使用的是MSYS的GCC,它确实停留在3.4.4版本,而且由于某种原因缺乏inttypes.h。然而,也有MinGW GCC附带了MinGW / MSYS,版本为4.8.1,随inttypes.h而来。
发布于 2015-01-03 21:57:54
inttypes.h是一个POSIX和C99头,而不是C++03,所以它不会在Windows上被C++03实现所用。
但是,由于这是2015年,您可以使用C++11及其cinttypes头,这是现代的、C++的、标准化的inttypes.h版本。
https://stackoverflow.com/questions/27759901
复制相似问题