没有找到-lstdc++-static的库

library not found for -lstdc++-static

本文关键字:-lstdc++-static 的库      更新时间:2023-10-16

我正在尝试构建wxFormBuilder_v3.5.0-beta-source。它附带了一个用于创建构建文件的shell文件,但是它总是遇到以下错误:

==== Building Premake4 ====
Linking Premake4
ld: library not found for -lstdc++-static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/release/premake4] Error 1
make: *** [Premake4] Error 2
./create_build_files4.sh: line 91: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 92: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 93: ./premake/macosx/bin/release/premake4: No such file or directory
./create_build_files4.sh: line 95: ./premake/macosx/bin/release/premake4: No such file or directory

我正在运行Mac OS X 10.9.4,是的,我已经安装了XCode,并且在这台机器上成功构建/安装了c++项目。

我知道我必须首先安装wxWidgets才能工作,并且我已经成功地构建/编译/安装了wxWidgets。

下面是shell文件的第87-96行(我在行号前面加了前缀供您参考):

[87] # Build premake
[88] cd build
[89] make CONFIG=Release -C./premake/$platform
[90]
[91] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch codeblocks
[92] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath codelite
[93] ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch $rpath gmake
[94] if [ "$platform" = "macosx" ]; then
[95]    ./premake/$platform/bin/release/premake4 --file=./premake/solution.lua $wxunicode $wxroot $wxversion $mediactrl $shared $arch xcode3
[96] fi

我不担心文件路径丢失。我试着从正确的目录直接运行make,仍然得到这个错误:

==== Building Premake4 ====
Linking Premake4
ld: library not found for -lstdc++-static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/release/premake4] Error 1
make: *** [Premake4] Error 2

我主要关心的是找到-lstdc++-static库并安装它,但我在网上找不到它。我能找到的唯一相关的东西是在编译iOS应用程序时改变XCode中的设置,这不是这里的情况。需要进行的任何更改都需要在文本编辑器中进行。

表示预制作文件路径:./premake/macosx/bin/release/premake4不存在。请注意,您使用的是相对路径(从。/开始),而不是绝对路径。尝试使用绝对路径并检查premake4可执行文件的位置。

ld: library not found for -lstdc++-static意味着你的链接器不能使用静态链接创建对象。请检查是否可以构建静态二进制文件。

创建hello world测试:

#include <iostream>
int main()
{
  std::cout << "Hello world!" << std::endl;
  return 0;
}

尝试构建它

clang++ test.cpp -o test

clang++ -static test.cpp -o test

这样一个测试的结果向您保证您是否能够创建二进制文件。