简体   繁体   English

MinGW找不到inttypes.h

[英]MinGW cannot find inttypes.h

I'm trying to follow the OpenGL 3D tutorials as shown here: http://www.arcsynthesis.org/gltut/index.html 我正在尝试遵循OpenGL 3D教程,如下所示: http : //www.arcsynthesis.org/gltut/index.html

And I've followed the instructions written for building the tutorials, but when I type make config=debug in the OpenGL SDK directory using MinGW's msys program after using the premake function, there is the one compiler error that says "inttypes.h: No such file or directory." 而且我已经按照构建教程的说明进行操作,但是在使用premake函数后,使用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>

I'm currently using MinGW to compile this, and I have to use both the Windows command prompt and MSYS to get this to work. 我目前正在使用MinGW进行编译,并且必须同时使用Windows命令提示符和MSYS才能使其正常工作。

Use a more updated version, download one of the packages here: 使用更新的版本,在此处下载软件包之一:

MinGW builds MinGW构建

Wichever stuff you use to compile (makefile, cmake, any IDE), you have to let it know where the C/C++ compiler is. 用于编译的Wichever东西(makefile,cmake,任何IDE),都必须让它知道C / C ++编译器在哪里。

I do that by setting up environment variables (it's more easy than it seems) with a script so that you do not pollute the "global environment": 我这样做是通过使用脚本设置环境变量(比看起来容易得多)来避免污染“全局环境”:

here's the batch file that allows you to use command line commands like "g++ -bla" 这是批处理文件,可让您使用命令行命令,例如“ 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

You just have to launch your ide from console (easy to do, instead of calling "cmd.exe" you could as well call "CodeBlocks.exe" or any other Ide/text editor/script runner, you just need to add its path to PATH). 您只需要从控制台启动ide(容易做到,您可以调用“ CodeBlocks.exe”或任何其他Ide /文本编辑器/脚本运行器来代替“ cmd.exe”,只需添加其路径即可。路径)。

You have of course to add yourself the path to missing programs like python/lua interpreter etc. Don't blame me for using Env Variables and command prompt, it is really making your life easier once you got the script with all things you need. 当然,您必须为缺少的程序(例如python / lua解释器等)添加自己的路径。不要怪我使用Env变量和命令提示符,这确实使您的生活变得更加轻松,只要您拥有了所有需要的脚本。 In example I use that in conjunction with CMake to do almost everything (cross compiling for Win,Mac,Linux,Android etc using various compiler versions because I maintaining a library, I also generate VS project files while developing so I could use nice completion features of VS also when compiling for Linux :D) 在示例中,我将其与CMake结合使用,几乎可以完成所有工作(使用各种编译器版本进行Win,Mac,Linux,Android等的交叉编译,因为我维护着一个库,在开发时也会生成VS项目文件,因此可以使用出色的完成功能为Linux编译时VS的代码:D)

Note that I no longer use MSYS nor MSYS2. 请注意,我不再使用MSYS或MSYS2。 I just use makefiles generated by Cmake. 我只使用Cmake生成的makefile。 and the make executable inside mingw32/bin folder (mingw32-make.exe) 以及mingw32/bin文件夹(mingw32-make.exe)中的make可执行文件

Oh, and remember that you need to enable c++11 with the following compile flag 哦,请记住,您需要使用以下编译标志启用c ++ 11

-std=c++11

after that you can include cinttypes freely. 之后,您可以自由包含cinttypes

You seem to be using the wrong environment / GCC compiler. 您似乎使用了错误的环境/ GCC编译器。 In this comment you say you're using MSYS' GCC, which indeed is stuck at version 3.4.4, and for some reason lacks inttypes.h . 此注释中,您说您正在使用MSYS的GCC,该版本确实停留在3.4.4版本,并且由于某种原因缺少inttypes.h However, there's also MinGW GCC that comes with MinGW / MSYS, and that is at version 4.8.1, and comes with inttypes.h . 但是,MinGW / MSYS附带有MinGW GCC,它的版本为4.8.1,并带有inttypes.h

inttypes.h is a POSIX and C99 header, not C++03, so it's not going to be available to a C++03 implementation on Windows. inttypes.h是POSIX和C99头文件,不是C ++ 03头文件,因此Windows上的C ++ 03实现将无法使用它。

However, since this is 2015, you can use C++11 and its cinttypes header which is the modern, C++, standardised version of inttypes.h . 但是,由于这是2015年,因此您可以使用C ++ 11及其cinttypes标头,它是inttypes.h的现代C ++标准化版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM