【发布时间】:2013-09-03 19:52:33
【问题描述】:
我尝试将picoc 项目编译成xcode。没有外部库,只有我在命令行工具 C 项目中导入的 .c 和 .h 文件。
所有 .c 文件编译都没有问题,但是当 XCode 链接时,我收到以下消息:
Undefined symbols for architecture x86_64:
"_BasicIOInit", referenced from:
_PicocInitialise in platform.o
"_CStdOut", referenced from:
_PrintSourceTextErrorLine in platform.o
_PlatformVPrintf in platform.o
"_MathFunctions", referenced from:
_IncludeInit in include.o
"_MathSetupFunc", referenced from:
_IncludeInit in include.o
"_PicocPlatformScanFile", referenced from:
_IncludeFile in include.o
...
给出错误的命令如下:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX10.8.sdk -L/Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncbwjsyjlax/Build/Products/Debug -F/Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncbwjsyjlax /Build/Products/Debug -filelist /Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncbwjsyjlax/Build/Intermediates/Pico.build/Debug/Pico.build/Objects-normal/x86_64/Pico.LinkFileList -mmacosx -version-min=10.8 -o /Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncbwjsyjlax/Build/Products/Debug/Pico
Pico.LinkFileList 文件正确地包含所有必需的 .o 文件的列表。
由于所有未找到的函数都在正确编译的 .c 文件中(并编译为 .o),我应该怎么做才能避免这些错误? 谢谢。
【问题讨论】:
-
是否可以显示产生链接器错误的命令?
-
检查是否所有 c 文件都添加到目标(文件检查器中的“目标成员”复选框)。
-
马丁:是的,他们都是。
-
Rob:请参阅已编辑的问题。谢谢!
标签: c xcode compiler-construction linker