Error in xcode project: ld: library not found for

2019-01-13 20:40发布

Just upgraded to Snow Leopard, installed Xcode 3.2, then installed iPhone SDK 3 for SL.

In a project, I now get the following error on build:

ld: library not found for -lcrt1.10.6.o

I've searched around the net, but nothing helpful can be found.

12条回答
地球回转人心会变
2楼-- · 2019-01-13 21:19

It looks like you're picking up libraries from /usr/lib, which is wholly inappropriate for the iPhone SDK. I would assume you've changed your build settings to add /usr/lib to the library search paths. This should be completely unnecessary in the first place, as /usr/lib is in the compiler's standard search paths, but if you need to have a modified search path like this, make sure to use $(SDKROOT)/usr/lib instead.

查看更多
戒情不戒烟
3楼-- · 2019-01-13 21:20

I had the same issue in a Fortran Makefile. Added the following option after the compiler (For OSX 10.5):

-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib

e.g.,

g77 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib

Now the compiler will find the library you want !

查看更多
Ridiculous、
4楼-- · 2019-01-13 21:21

Edit Project Settings -> In the build tab -> For Mac OS X Deployment Target, change it to 10.5 for XCode 3 (not 10.6 even if on 10.6) and see if that helps.

For XCode 4, you'll need to set it to 10.6

P.S. Make sure you set that for all targets, not just release or debug. (if you didn't, one would fail, the other wouldn't)

查看更多
孤傲高冷的网名
5楼-- · 2019-01-13 21:23

Add the following to ~/.profile (for Mac OS X 10.5):

export C_INCLUDE_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/include
export LIBRARY_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/lib
查看更多
迷人小祖宗
6楼-- · 2019-01-13 21:23

This problem solved by setting Mac OS X Deployment Target to 10.5 and after this set back to Compiler Default :)

查看更多
太酷不给撩
7楼-- · 2019-01-13 21:31

I was able to fix this problem by adding the following to my Makefile:

CFLAGS="$(OTHER_CFLAGS) -mmacosx-version-min=10.5"
LDFLAGS="$(OTHER_LDFLAGS) -mmacosx-version-min=10.5"

Ostensibly, this is only required when building outside of Xcode. This problem frustrated me long enough that I figured it would be useful to share my experience here.

查看更多
登录 后发表回答