ld:未找到-lgcc_ext.10.5的库 [英] ld: library not found for -lgcc_ext.10.5
问题描述
我试图为学校编译一个基本的C ++程序,当我尝试从Mac终端(10.7.6)运行它,我收到这个消息:
ld:库找不到-lgcc_ext.10.5
collect2:错误:ld返回1退出状态
我肯定在正确的目录中,并安装了XCode Command Line工具。这是我的命令提示符:
g ++ -o chapter_2 hello_world.cpp
pre>
这是我的基本c ++程序。
#include< ; iostream>
using namespace std;
int main(){
cout<< Hello world<< endl;
}
解决方案
当我检查
$ which g ++ $ c时,会出现同样的问题,在OS X 10.8上,当前XCode和gcc都安装了Homebrew。 $ c>它给了
/ usr / local / bin / g ++
。
c $ c> .bash_profile :
#PATH =/ usr / local / bin:$ {PATH}
现在
$ which g ++
给出/ usr / bin / g ++
,其版本表示它来自XCode,没有找到ld:library -lgcc_ext.10.5
错误。I'm trying to compile a basic C++ program for school and when I try running it from the Mac Terminal (10.7.6), I get this message:
ld: library not found for -lgcc_ext.10.5 collect2: error: ld returned 1 exit status
I'm definitely in the correct directory and installed XCode Command Line tools. Here is my command prompt:
g++ -o chapter_2 hello_world.cpp
Here is my basic c++ program.
#include <iostream> using namespace std; int main(){ cout << "Hello world" << endl; }
解决方案I had the same problem, on OS X 10.8, with both current XCode and gcc installed by Homebrew.
When I checked
$ which g++
it gave/usr/local/bin/g++
.So I commented this path in
.bash_profile
:#PATH="/usr/local/bin:${PATH}"
Now
$ which g++
gives/usr/bin/g++
and its version indicates that it is from XCode and there is nold: library not found for -lgcc_ext.10.5
error.这篇关于ld:未找到-lgcc_ext.10.5的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!