ld.exe: 找不到 -lstdc++编译 c++ 时出错程序
从 Windows 终端编译一个简单的 C++ Hello World 程序:g++ main.cpp
给出此错误:
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lstdc++
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
collect2.exe: error: ld returned 1 exit status
The c++ program:
#include <iostream>
int main()
{
std::cout << "Hello C++!\n";
return 0;
}
MinGW path is set up on windows
Compiling a simple C++ Hello World program from windows terminal by: g++ main.cpp
gives this error:
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lstdc++
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
d:/softwares/mingw/bin/...../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
collect2.exe: error: ld returned 1 exit status
The c++ program:
#include <iostream>
int main()
{
std::cout << "Hello C++!\n";
return 0;
}
MinGW path is set up on windows
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
g++
作为链接器而不是ld
。Try using
g++
as linker instead ofld
.