"Undefined symbols for architecture x86_64:"

24,750

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.

Share:
24,750
h4x0rjax
Author by

h4x0rjax

I'm a good coder.

Updated on March 07, 2020

Comments

  • h4x0rjax
    h4x0rjax about 4 years

    I am attempting to compile this library on mac os x Mavericks 10.9.3 64-bit: 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

    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.

    This is what I did after untarring the distribution:
    (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)

  • Patricia
    Patricia about 9 years
    I am new to CMake, so I need a little help here. I'm getting Undefined symbols for architecture x86_64 for boost. I am using CLion, which uses Cmake. This is what I have at the bottom of my CMakeLists.txt file: find_package(OpenCV REQUIRED) find_package(Boost 1.55.0 REQUIRED COMPONENTS filesystem thread chrono system atomic program_options) include_directories(${Boost_INCLUDE_DIRS}) add_executable(Oneprint ${SOURCE_FILES}) target_link_libraries(Oneprint ${OpenCV_LIBS}) target_link_libraries(Oneprint ${Boost_LIBRARIES}) How would I use your above suggestion (actual name or alias)?