简体   繁体   中英

Apple Mach-O Linker Warning Directory not found

I have spent my last five hours looking for this weird situation a reasonable explanation.

Here is the warning:

ld: warning: directory not found for option '-L/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0/Extend/SDKExport'
ld: warning: directory not found for option '-F/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0/Connection'
ld: warning: directory not found for option '-F/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0/Core'
ld: warning: directory not found for option '-F/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0/Extend'
ld: warning: directory not found for option '-F/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0'
ld: warning: directory not found for option '-F/Users/oasis_weng/Desktop/My Life/Life For Myself/Programming/Projects/ChangWeiBo/../xCodeExamples/ShareSDK/ShareSDK_v2.1.0/UI'

However though, I know all those alleged " missing files " are truly and actually existed in my application folder and the app runs properly with these files.

The problem of those directories in the warning is the actual path do not include the ../xCodeExamples/ part.

What should I do to get these warning away?

You have to follow these step:

  • Click on your project (targets)
  • Click on Build Settings
  • Under "Library Search Paths", delete the paths
  • Clean your build and run again.

Good Luck !!

For me, the bad path was under Framework Search Paths.

The easiest way to find where the bad path is, is to type a part of it in the search box on the top right. That will filter the list to only that one bad path. Deleting it, as the other answer suggests, fixes the problem.

See this answer for more info.

Had the same problem today with different solution (might help someone).

If your source directory name $(SRCROOT) include spaces, use "$(SRCROOT)" instead of $(SRCROOT) in Library Search Paths.

Let's say your directory name is "ABC". If you use $(SRCROOT) you might get something like:

directory not found for option '-LA'
directory not found for option '-LB'
directory not found for option '-LC'

还要检查构建设置 - >框架搜索路径以查找未使用的文件夹(当我今天从项目中删除Carthage时发生了这种警告)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM