gpt4 book ai didi

c++ - MinGW 找不到 inttypes.h

转载 作者:可可西里 更新时间:2023-11-01 09:53:07 26 4
gpt4 key购买 nike

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

我已经按照为构建教程编写的说明进行操作,但是当我在使用 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: <code>GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4322: error: ISO C++ forbids declaration of</code>tim
eout' with no type
include/glload/_int_gl_exts.hpp:4328: error: <code>GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4328: error: ISO C++ forbids declaration of</code>tim
eout' with no type
include/glload/_int_gl_exts.hpp:4355: error: <code>GLuint64' has not been declared
include/glload/_int_gl_exts.hpp:4355: error: ISO C++ forbids declaration of</code>par
ams' with no type
include/glload/_int_gl_exts.hpp:5273: error: ISO C++ forbids declaration of <code>GLu
int64' with no type
include/glload/_int_gl_exts.hpp:5273: error: typedef</code>gl::_detail::GLuint64' is
initialized (use <strong>typeof</strong> instead)
include/glload/_int_gl_exts.hpp:5273: error: <code>Proc_glGetImageHandleARB' was not
declared in this scope
include/glload/_int_gl_exts.hpp:5273: error: expected</code>,' or <code>;' before '(' toke
n
include/glload/_int_gl_exts.hpp:5276: error:</code>GLuint64EXT' has not been declared<p></p>

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 才能让它工作。

最佳答案

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

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 解释器等)的路径。不要怪我使用 Env 变量和命令提示符,一旦您获得包含所有内容的脚本,它真的会让您的生活更轻松你需要。在示例中,我将它与 CMake 结合使用来完成几乎所有事情(使用各种编译器版本对 Win、Mac、Linux、Android 等进行交叉编译,因为我维护了一个库,我还在开发时生成 VS 项目文件,因此我可以使用很好的完成功能VS 在为 Linux 编译时也是如此 :D)

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

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

-std=c++11

之后你可以自由地包含cinttypes

关于c++ - MinGW 找不到 inttypes.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27759901/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com