在 XCode 4 的 i386 应用程序的 dylib 中使用 Sqlite
对于 iOS,我需要从目录中添加一个名为 libsqlite3.0.dylib 的文件:/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/
我有一种从 sqlite DB 的列中获取 MaxID 的方法。这在我制作的通用 iOS 应用程序中运行良好。我想将此代码移植到 Mac 应用程序 i386。
因为我找不到这样的 i386 dylib,所以我使用下载文件创建了一个:sqlite-autoconf-3070500.tar.gz
按照指示,我在 /usr/local/lib 中生成了 3 个文件
libsqlite3.a libsqlite3.la libsqlite3.dylib
在 XCode 中,我将 '/usr/local/lib' 添加到 Build Setting->Search Paths->Library Search Paths
我用过: export DYLD_LIBRARY_PATH=/usr/local/bin/:$DYLD_LIBRARY_PATH
当我取消注释 AppDelegate.m 中的 sqlite 代码时,我收到以下构建错误
ld /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc 正常 i386 cd /Users/appleuser/Cocoa/iHungryMacNonDoc setenv MACOSX_DEPLOYMENT/TAR usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug -L /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib -L/Users/appleuser/Cocoa/iHungryMacNonDoc/../SqliteLib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/ SDKs/iPhoneSimulator4.3。sdk/usr/lib -F/Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug-filelist /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc///中间体/iHungryMacNonDoc.build/Debug/iHungryMacNonDoc.build/Objects-normal/i386/iHungryMacNonDoc.LinkFileList -mmacosx-version-min=10.6 -framework Cocoa -lsqlite3.0.8.6 -o /Users/appleuser/Library/Developer/Xcode /DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc6 -framework Cocoa -lsqlite3.0.8.6 -o /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc6 -framework Cocoa -lsqlite3.0.8.6 -o /Users/appleuser/Library/Developer/Xcode/DerivedData/iHungryMacNonDoc-dakfnxxiwzxehygtwrboebgysgwc/Build/Products/Debug/iHungryMacNonDoc.app/Contents/MacOS/iHungryMacNonDoc
ld:找不到文件:/usr/lib/system/libdispatch_sim.dylib 用于架构 i386 collect2:ld 返回 1 退出状态命令 /Developer/usr/bin/llvm-gcc-4.2 失败,退出代码为 1
AppDelegate.h 开始 ///////////
导入“AppDelegate.h”
导入“IngredXML.h”
导入“XmlListReader.h”
导入“常量.h”
进口
进口
导入“/usr/include/sqlite3.h”
非常感谢您阅读本文。请指教。标记