在Mac上用Xcode6編譯錯誤,在windows下面Visual Studio 編譯沒問題,然后查看報錯信息:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
can't locate file for
file: -lpng is not an object file (not allowed in a library)
1 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lpng 2 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lpng is not an object file (not allowed in a library) 3 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -ljpeg 4 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -ljpeg is not an object file (not allowed in a library) 5 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -ltiff 6 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -ltiff is not an object file (not allowed in a library) 7 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lwebp 8 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lwebp is not an object file (not allowed in a library) 9 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lfreetype 10 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lfreetype is not an object file (not allowed in a library) 11 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lwebsockets 12 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lwebsockets is not an object file (not allowed in a library) 13 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lcurl 14 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lcurl is not an object file (not allowed in a library)
原因其實很簡單,就是Cocod2d-x的Mac和iOS靜態庫沒有搜索到,
一般是使用svn客戶端沒有正確上傳.a導致的,
解決方法:把找到對應版本的Cocod2d-x相應目錄下面的.a文件復制到相應目錄下,
然后把.a的靜態庫添加到svn的版本控制里面;
使用命令
svn add 路徑/靜態庫.a
iOS的庫文件路徑如下:
/opt/cocos2d-x-3.2> find . -type f | grep -i ios/lib ./external/curl/prebuilt/ios/libcurl.a ./external/freetype2/prebuilt/ios/libfreetype.a ./external/jpeg/prebuilt/ios/libjpeg.a ./external/lua/lua/prebuilt/ios/liblua.a ./external/lua/luajit/prebuilt/ios/libluajit.a ./external/png/prebuilt/ios/libpng.a ./external/tiff/prebuilt/ios/libtiff.a ./external/webp/prebuilt/ios/libwebp.a ./external/websockets/include/ios/libwebsockets.h ./external/websockets/prebuilt/ios/libwebsockets.a ./plugin/plugins/flurry/proj.ios/libFlurry.a ./plugin/plugins/umeng/proj.ios/libMobClickLibrary.a