[英]Link C++ with statically , libraries not found
我想用-static
標志鏈接一個g ++二進制文件,但是我在使用fedora 29時遇到此錯誤
錯誤
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
碼
#include <iostream>
int main(){
std::cout << "Hello" << std::endl;
return 0;
}
G ++線
g++ static.cc -o static -static
感謝托馬斯,我在執行注釋的過程中找到了解決方案
yum install glibc-static
yum install libstdc++-static
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.