草庐IT

c++ - MinGW 找不到 inttypes.h

coder 2024-06-08 原文

我正在尝试按照此处所示的 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/

有关c++ - MinGW 找不到 inttypes.h的更多相关文章

  1. ruby-on-rails - 如何优雅地重启 thin + nginx? - 2

    我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server

  2. ruby - 使用 `+=` 和 `send` 方法 - 2

    如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:

  3. ruby-on-rails - rbenv:从 RVM 移动到 rbenv 后,在 Jenkins 执行 shell 中找不到命令 - 2

    我从Ubuntu服务器上的RVM转移到rbenv。当我使用RVM时,使用bundle没有问题。转移到rbenv后,我在Jenkins的执行shell中收到“找不到命令”错误。我内爆并删除了RVM,并从~/.bashrc'中删除了所有与RVM相关的行。使用后我仍然收到此错误:rvmimploderm~/.rvm-rfrm~/.rvmrcgeminstallbundlerecho'exportPATH="$HOME/.rbenv/bin:$PATH"'>>~/.bashrcecho'eval"$(rbenvinit-)"'>>~/.bashrc.~/.bashrcrbenvversions

  4. ruby - 如何计算 Liquid 中的变量 +1 - 2

    我对如何计算通过{%assignvar=0%}赋值的变量加一完全感到困惑。这应该是最简单的任务。到目前为止,这是我尝试过的:{%assignamount=0%}{%forvariantinproduct.variants%}{%assignamount=amount+1%}{%endfor%}Amount:{{amount}}结果总是0。也许我忽略了一些明显的东西。也许有更好的方法。我想要存档的只是获取运行的迭代次数。 最佳答案 因为{{incrementamount}}将输出您的变量值并且不会影响{%assign%}定义的变量,我

  5. ruby-on-rails - 找不到 gem railties (>= 0.a) (Gem::GemNotFoundException) - 2

    我已经看到了一些其他的问题,尝试了他们的建议,但没有一个对我有用。我已经使用Rails大约一年了,刚刚开始一个新的Rails项目,突然遇到了问题。我卸载并尝试重新安装所有Ruby和Rails。Ruby很好,但Rails不行。当我输入railss时,我得到了can'tfindgemrailties。我当前的Ruby版本是ruby2.2.2p95(2015-04-13修订版50295)[x86_64-darwin15],尽管我一直在尝试通过rbenv设置ruby​​2.3.0。如果我尝试rails-v查看我正在运行的版本,我会得到同样的错误。我使用的是MacOSXElCapitan版本10

  6. 即使安装了 gem,Ruby 也找不到所需的库 - 2

    我花了几天时间尝试安装ruby​​1.9.2并让它与gems一起工作:-/我最终放弃了我的MacOSX10.6机器,下面是我的Ubuntu机器上的当前状态。任何建议将不胜感激!#rubytest.rb:29:in`require':nosuchfiletoload--mongo(LoadError)from:29:in`require'fromtest.rb:1:in`'#cattest.rbrequire'mongo'db=Mongo::Connection.new.db("mydb")#gemwhichmongo/usr/local/rvm/gems/ruby-1.9.2-p0/g

  7. ruby - Sinatra 找不到 View 目录 - 2

    我正在尝试以一种更类似于普通RubyGem结构的方式构建我的Sinatra应用程序。我有以下文件树:.├──app.rb├──config.ru├──Gemfile├──Gemfile.lock├──helpers│  ├──dbconfig.rb│  ├──functions.rb│  └──init.rb├──hidden│  └──Rakefile├──lib│  ├──admin.rb│  ├──api.rb│  ├──indexer.rb│  ├──init.rb│  └──magnet.rb├──models│  ├──init.rb│  ├──invite.rb│  ├─

  8. ruby - 在 SUSE 上找不到 Ruby 的头文件? - 2

    我正在尝试在SUSEEnterprise11SP3上安装compass。我得到以下信息。有什么想法吗?geminstallcompassBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingcompass:ERROR:Failedtobuildgemnativeextension./usr/bin/rubyextconf.rbmkmf.rbcan'tfindheaderfilesforrubyat/usr/lib64/ruby/ruby.hextconffailed,exitcode1Gemfileswi

  9. arrays - Ruby 数组 += vs 推送 - 2

    我有一个数组数组,想将元素附加到子数组。+=做我想做的,但我想了解为什么push不做。我期望的行为(并与+=一起工作):b=Array.new(3,[])b[0]+=["apple"]b[1]+=["orange"]b[2]+=["frog"]b=>[["苹果"],["橙子"],["Frog"]]通过推送,我将推送的元素附加到每个子数组(为什么?):a=Array.new(3,[])a[0].push("apple")a[1].push("orange")a[2].push("frog")a=>[[“苹果”、“橙子”、“Frog”]、[“苹果”、“橙子”、“Frog”]、[“苹果”、“

  10. += 的 Ruby 方法 - 2

    有没有办法让Ruby能够做这样的事情?classPlane@moved=0@x=0defx+=(v)#thisiserror@x+=v@moved+=1enddefto_s"moved#{@moved}times,currentxis#{@x}"endendplane=Plane.newplane.x+=5plane.x+=10putsplane.to_s#moved2times,currentxis15 最佳答案 您不能在Ruby中覆盖复合赋值运算符。任务在内部处理。您应该覆盖+,而不是+=。plane.a+=b与plane.a=

随机推荐