首页 > 解决方案 > 编译 C++ 程序的问题

问题描述

我正在尝试在我的新 Conda 环境中编译一个简单的 Hello World C++ 程序,但它返回一个退出状态,如下所示。

/home/ep/anaconda3/bin/../lib/gcc/x86_64-conda-linux-gnu/7.5.0/../../../../x86_64-conda-linux-gnu/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status

g++也安装好了,在anaconda3的lib目录下也可以找到libstdc++.so。

g++ (crosstool-NG 1.24.0.131_87df0e6_dirty) 7.5.0
Copyright (C) 2017 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++linuxanaconda

解决方案


您还需要安装库的开发文件libstdc++

例如,你在 Debian/Ubuntu

sudo apt install libstdc++-8-dev

推荐阅读