MinGW找不到inttypes.h

时间:2015-01-03 21:51:03

标签: c++ windows opengl

我正在尝试按照此处显示的OpenGL 3D教程: http://www.arcsynthesis.org/gltut/index.html

我已经按照用于构建教程的说明进行了操作,但是当我在使用预制函数后使用MinGW的msys程序在OpenGL SDK目录中键入make config = debug时,有一个编译器错误,说" inttypes.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才能使其正常工作。

3 个答案:

答案 0 :(得分:2)

使用更新版本,请在此处下载其中一个软件包:

MinGW builds

你用来编译的任何东西(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 interpreter等。不要怪我使用Env变量和命令提示符,一旦你得到了所有东西的脚本,它真的会让你的生活更轻松你需要。在示例中,我使用它与CMake一起做几乎所有事情(使用各种编译器版本交叉编译Win,Mac,Linux,Android等因为我维护了一个库,我也在开发时生成VS项目文件,所以我可以使用很好的完成功能在编译Linux时也是VS:D)

请注意,我不再使用MSYS或MSYS2。我只使用Cmake生成的makefile。和mingw32/bin文件夹(mingw32-make.exe)中的make可执行文件

哦,请记住,您需要使用以下编译标志启用c ++ 11

-std=c++11

之后,您可以自由地加入cinttypes

答案 1 :(得分:2)

您似乎使用了错误的环境/ GCC编译器。在this comment中,您说您正在使用MSYS&#39; GCC,确实停留在版本3.4.4,并且由于某种原因缺少inttypes.h。但是,还有MinGW / MSYS附带的 MinGW GCC,版本为4.8.1,并附带inttypes.h

答案 2 :(得分:1)

inttypes.h是一个POSIX和C99标题,而不是C ++ 03,所以它不适用于Windows上的C ++ 03实现。

但是,由于这是2015年,您可以使用C ++ 11及其cinttypes标题,这是inttypes.h的现代C ++标准化版本。