链接错误 - OSX上架构x86_64的未定义符号

时间:2013-03-21 17:04:52

标签: macos gcc x86-64

尝试在OSX下编译项目的一部分时返回以下内容:

gcc -g -pipe -L/Projects/export buf_test.o buf.o -framework CoreFoundation -o buf_test
Undefined symbols for architecture x86_64:
  "___assert_rtn", referenced from:
      _init in buf.o
      _get in buf.o
      _put in buf.o
  "___sprintf_chk", referenced from:
      _test in buf_test.o
  "___strcpy_chk", referenced from:
      _test_data_copy in buf_test.o
      ___inline_strcpy_chk in buf_test.o
  "_exit", referenced from:
      start in crt1.10.6.o
  "_printf", referenced from:
      _test in buf_test.o
  "_puts", referenced from:
      _test in buf_test.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

非常感谢帮助!

1 个答案:

答案 0 :(得分:0)

原来这是一个库命名与标准库的冲突 - 我在/ Projects / export中有一个名为libSystem.a的库,它掩盖了libSystem.dylib的被发现。