首页 > 解决方案 > ld 无法使用 g++ 命令找到 /lib64/libmvec.so.1

问题描述

我开始使用简单的 hello world 代码学习在 linux 上构建的 c++ 项目。

#include <iostream>

int main(){
    std::cout<<"hello,world"<<std::endl;
    return 0;
} 

当我尝试运行命令时

g++ hello.cpp

它失败了:

/opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/ld: cannot find /usr/lib64/libmvec_nonshared.a
/opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/ld: cannot find /lib64/libmvec.so.1

但是当我尝试

gcc -lstdc++ hello.cpp

编译成功,生成可执行文件a.out。

那么 g++ 有什么问题呢?

标签: c++gccg++

解决方案


推荐阅读