Mingw 使用gcc标志-m32生成后出现错误0xc000007b
我安装了mingw-w64,因为我需要C++11/C11多线程功能来执行armadillo库(),但我也需要用32位dll编译程序。当我用标记-m32编译这个32位程序时,运行它时没有问题,但当我用armadillo库用这个标记运行程序时,会出现错误0xc000007b。对于使用armadillo库构建程序,我需要链接32位Arquit体系结构的英特尔数学内核库() 我已经尝试过使用,但结果没有说明任何问题 这是我使用的命令行:Mingw 使用gcc标志-m32生成后出现错误0xc000007b,mingw,mingw-w64,armadillo,intel-mkl,Mingw,Mingw W64,Armadillo,Intel Mkl,我安装了mingw-w64,因为我需要C++11/C11多线程功能来执行armadillo库(),但我也需要用32位dll编译程序。当我用标记-m32编译这个32位程序时,运行它时没有问题,但当我用armadillo库用这个标记运行程序时,会出现错误0xc000007b。对于使用armadillo库构建程序,我需要链接32位Arquit体系结构的英特尔数学内核库() 我已经尝试过使用,但结果没有说明任何问题 这是我使用的命令行: g++ --std=c++11 -o PruebaArmadill
g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_32\redist\ia32_win\mkl -lmkl_rt -m32
我在windows 10上使用g++(x86_64-posix-sjlj-rev0,由MinGW-W64项目构建)8.1.0
代码
#包括
#包括
编辑
为了澄清某些方面,我在这里展示了使用mingw和mingw-w64编译的相同代码的结果
对于mingw:
C:\MicoCode\prueba1>g++ --version
g++ (MinGW.org GCC-8.2.0-5) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\MicoCode\prueba1>g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_32\redist\ia32_win\mkl -lmkl_rt
In file included from C:\armadillo-9.800.4\include/armadillo:171,
from PruebaArmadillo.cpp:4:
C:\armadillo-9.800.4\include/armadillo_bits/SpMat_bones.hpp:675:29: error: 'mutex' in namespace 'std' does not name a type
arma_aligned mutable std::mutex cache_mutex;
这会导致互斥错误,这就是为什么我需要使用mingw-w64,但这给了我在开始时指出的错误。但是,如果我使用64位的mkl库,它的工作很好:
C:\MicoCode\prueba1>g++ --version
g++ (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\MicoCode\prueba1>g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_2\redist\intel64_win\mkl -lmkl_rt
C:\MicoCode\prueba1>PruebaArmadillo.exe
1.0000
1.0000
3.0000
最后,我找到了解决方案,出现错误是因为系统找不到32位库,因为程序是在64位Arquit体系结构上编译的。为了解决这个问题,将这些库作为path环境变量包含就足够了。可在以下位置找到它的32位库:
C:\-\mingw64\x86\u 64-w64-mingw32\lib32
0xc00007b
如果链接了hello,world,则状态无效\u图像\u格式
!程序具有相同的配置(-m32
),它是否运行或失败并出现相同的错误?Jin oh Kang我编辑帖子以查看程序。hello world程序运行正常,问题是当我链接库时。@RafaHernádez尝试将DLL的32位版本放在可执行文件所在的目录中。这可能是因为Windows试图在您的32位程序中加载64位版本的armadillo。@Jin ohKang不断给出相同的错误