xcode “架构 x86_64 的未定义符号:”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24270411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:07:28  来源:igfitidea点击:

"Undefined symbols for architecture x86_64:"

xcodemacoscmakeclangdylib

提问by h4x0rjax

I am attempting to compile this library on mac os x Mavericks 10.9.3 64-bit: http://www.openfec.org/downloads.html

我正在尝试在 mac os x Mavericks 10.9.3 64 位上编译这个库:http: //www.openfec.org/downloads.html

I followed the README exactly, and got this error:

我完全按照自述文件进行操作,并收到此错误:

Linking C shared library ../../bin/Release/libopenfec.dylib

   Undefined symbols for architecture x86_64:
      "_of_add_from_multiple_symbols", referenced from:
         _of_linear_binary_code_backward_substitution in of_ml_tool.c.o
      "_of_add_to_symbol", referenced from:
         _of_linear_binary_code_decode_with_new_symbol in of_it_decoding.c.o
         _of_linear_binary_code_simplify_linear_system in of_ml_decoding.c.o
         _of_linear_binary_code_col_forward_elimination_pivot_reordering in of_ml_tool.c.o
         _of_linear_binary_code_apply_gauss_pivoting in of_ml_tool_2.c.o
         _of_linear_binary_code_inject_symbol_in_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_solve_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_invert_dense_system in of_ml_tool_2.c.o
         ...
      "_of_calloc", referenced from...:
         ...

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: * [../bin/Release/libopenfec.dylib] Error 1
make[1]: *
[src/CMakeFiles/openfec.dir/all] Error 2
make: *** [all] Error 2

链接 C 共享库 ../../bin/Release/libopenfec.dylib

   Undefined symbols for architecture x86_64:
      "_of_add_from_multiple_symbols", referenced from:
         _of_linear_binary_code_backward_substitution in of_ml_tool.c.o
      "_of_add_to_symbol", referenced from:
         _of_linear_binary_code_decode_with_new_symbol in of_it_decoding.c.o
         _of_linear_binary_code_simplify_linear_system in of_ml_decoding.c.o
         _of_linear_binary_code_col_forward_elimination_pivot_reordering in of_ml_tool.c.o
         _of_linear_binary_code_apply_gauss_pivoting in of_ml_tool_2.c.o
         _of_linear_binary_code_inject_symbol_in_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_solve_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_invert_dense_system in of_ml_tool_2.c.o
         ...
      "_of_calloc", referenced from...:
         ...

ld:找不到架构 x86_64 的符号
clang:错误:链接器命令失败,退出代码 1(使用 -v 查看调用)
make[2]:* [../bin/Release/libopenfec.dylib] 错误 1
make[1]: *
[src/CMakeFiles/openfec.dir/all] 错误 2
make: *** [all] 错误 2

I simply followed the README for OpenFEC's distro (found at http://www.openfec.org/downloads.html). When attempting to make, this error arises. I have no idea what the problem is.

我只是遵循 OpenFEC 发行版的自述文件(可在http://www.openfec.org/downloads.html找到)。尝试制作时,会出现此错误。我不知道问题是什么。

This is what I did after untarring the distribution:
(1.): mkdir build
(2.): cd build
(3.): cmake .. -DDEBUG:STRING=OFF
(4.): make

这是我解压发行版后所做的:
(1.): mkdir build
(2.): cd build
(3.): cmake .. -DDEBUG:STRING=OFF
(4.): make

Any ideas?

有任何想法吗?

Edit: Attempted to force cmake to use 64-bit, still didn't work.
(Tried to force it into 32-bit just for kicks, also didn't work)

编辑:试图强制 cmake 使用 64 位,仍然没有用。
(试图将其强制为 32 位只是为了踢,也没有用)

回答by zcourts

FYI, if this wasn't resolved. Check that you're linking to your libraries properly.

仅供参考,如果这没有解决。检查您是否正确链接到您的库。

FIND_LIBRARY(LIB_NAME_LIB lib)
TARGET_LINK_LIBRARIES(my_executable ${LIB_NAME_LIB})

In your CMakeLists.txt file.

在您的 CMakeLists.txt 文件中。