使用gcc标志-m32构建后出现错误0xc000007b

我安装了mingw-w64是因为我需要C ++ 11 / C11多线程功能来执行犰狳库(http://arma.sourceforge.net/),但我也需要使用32位dll编译程序。当我使用标志-m32编译此32位程序时,运行该程序没有问题,但是当我使用该标志运行带有armadillo库的程序时,出现错误0xc000007b。对于使用armadillo库构建程序,我需要链接Intel Math Kernel library(https://software.intel.com/en-us/mkl)以获得32位arquitecture。

我已经尝试使用dependency walker,但是结果并不能说明任何问题。

这是我使用的命令行:

g++ --std=c++11 -o PruebaArmadillo PruebaArmadillo.cpp -IC:\armadillo-9.800.4\include -LC:\mkl_32\redist\ia32_win\mkl -lmkl_rt -m32

我使用g ++在Windows 10上工作(x86_64-posix-sjlj-rev0,由MinGW-W64项目构建)8.1.0

代码

#include <iostream>
#include <armadillo>
#include <vector>


using namespace std;
using namespace arma;

int main()
  {

    vec p = { 1,1,3 };
    cout << p << endl;
}

结果

使用gcc标志-m32构建后出现错误0xc000007b


编辑

为了阐明某些方面,我在这里显示了用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,但是这却给了我开始时指出的错误。但是,如果我将mkl库用于64位,则可以正常工作:

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
jinnaying 回答:使用gcc标志-m32构建后出现错误0xc000007b

最后,我找到了解决方案,出现了该错误,因为系统无法在32位库中编译该程序,因为系统找不到32位库。要解决此问题,只需将这些库包含为路径环境变量即可。可在以下位置找到32位库: C:\---\mingw64\x86_64-w64-mingw32\lib32

本文链接:https://www.f2er.com/2691881.html

大家都在问