链接c项目时架构x86_64的未定义符号
我尝试将项目编译成xcode。没有外部库,只有我在命令行工具c项目中导入的.c和.h文件 所有.c文件编译时都没有问题,但当XCode链接时,我收到以下消息:链接c项目时架构x86_64的未定义符号,c,xcode,compiler-construction,linker,C,Xcode,Compiler Construction,Linker,我尝试将项目编译成xcode。没有外部库,只有我在命令行工具c项目中导入的.c和.h文件 所有.c文件编译时都没有问题,但当XCode链接时,我收到以下消息: Undefined symbols for architecture x86_64: "_BasicIOInit", referenced from: _PicocInitialise in platform.o "_CStdOut", referenced from: _PrintSourceTe
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/toolschains/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 dhfbamkhiyphjcwwuncwuncwjwjwjwjwjwjwjw-F/Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncbwjsyjlax/Build/Products/Debug-filelist/Users/laurent/Library/Developer/Xcode/DerivedData/Pico-dhfwbamkhiyphjcwuncwwwjwjwjwjsyjlax/Build/Intermediates/Pico.Build/Objects-normal/x86_64/Pico.LinkFileList-mmacox最小版本=10.8-o/用户/laurent/Library/Developer/Xcode/DerivedData/Pico dhfwbamkhiyphjcwuncbwjsyjlax/Build/Products/Debug/Pico
Pico.LinkFileList文件正确地包含所有必需的.o文件的列表。
由于所有未找到的函数都在正确编译的.c文件中(并编译为.o),我应该如何避免这些错误?
谢谢。这些符号在
clibrary.c
中;您一定是从要编译的源文件列表中遗漏了它
你的下一个问题无疑是关于链接可执行文件的库,为了解决这个问题,我建议你看看
Makefile
,以防它能帮助别人,我发现一些#ifdef命令不包括要编译的函数。在同样的情况下,将Pico添加到目标依赖项列表对我来说很有效。(来自Pico,我指的是我们创建库的xcode项目文件夹)
参考:
是否可以显示生成链接器错误的命令?检查是否将所有c文件添加到目标(“文件检查器”中的“目标成员身份”复选框)。马丁:是的,它们都是。罗布:请参阅编辑的问题。谢谢在那里,问题最终是由于一些ifdef排除了要编译的函数。如果你想帮助人们,你不同意你应该提供更多的细节,而不是模糊地引用一些未指定的设置/缺少的东西吗?只是说。。。