gpt4 book ai didi

c++ - 找不到 -lstdc++-static 的库

转载 作者:太空宇宙 更新时间:2023-11-04 11:29:39 26 4
gpt4 key购买 nike

我正在尝试构建 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 文件路径:./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

此类测试的结果向您保证您是否能够创建二进制文件。

关于c++ - 找不到 -lstdc++-static 的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25276745/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com