我的笔记本电脑上安装了多个版本的c++编译器。我试图用一个32位编译器使用g++-9.3构建我的代码.因此,我尝试使用multilib安装sudo apt-get install gcc-multilib g++-multilib,并尝试安装以下软件包sudo apt install g++-9-multilib sudo apt install gcc-9-multilib
然而,结果是
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-multilib is already the newest version (4:7.4.0-1ubuntu2.3).
gcc-multilib is already the newest version (4:7.4.0-1ubuntu2.3).
0 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.现在激活的gcc是
sudo update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-9 60 auto mode
1 /usr/bin/gcc-6 40 manual mode
2 /usr/bin/gcc-7 50 manual mode
3 /usr/bin/gcc-9 60 manual mode
Press <enter> to keep the current choice[*], or type selection number:
> sudo update-alternatives --config g++
There are 3 choices for the alternative g++ (providing /usr/bin/g++).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/g++-9 60 auto mode
1 /usr/bin/g++-6 40 manual mode
2 /usr/bin/g++-7 50 manual mode
3 /usr/bin/g++-9 60 manual mode> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-11ubuntu0~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-11ubuntu0~18.04.1) gcc仍然试图以64位的方式构建代码,从而产生编译错误。
/usr/include/c++/9/bits/random.h:103:26: error: expected unqualified-id before ‘__int128’
103 | { typedef unsigned __int128 type; };
| 要让apt安装multlib for g++9.3.0才能编译32位代码库,我需要做什么?
发布于 2021-02-02 04:56:56
糟糕的是,我在make文件-I/usr/include/x86_64-linux-gnu/c++/9中有以下设置
在删除包含路径后,编译器将按预期工作。
https://askubuntu.com/questions/1311590
复制相似问题