Apple Mach-O linker (id) warning : building for MacOSX, but linking against dylib built for iOS

后端 未结 4 1940
Happy的楠姐
Happy的楠姐 2020-12-05 23:28

Starting from some point in the past xCode 4 in complaining about linker problems:

ld: warning: building for MacOSX, but linking against dylib built f

4条回答
  •  执笔经年
    2020-12-06 00:03

    Check your Framework Search Paths for your Main target and your test Target.

    I had a lot of crap in mine.

    had old project written in XCode 4 and just started to use Unit Tests in XCode 5.

    Here's the minimum I have to get my test project to run

    Project Navigator > click on project at top >
    Targets > Build Settings > Framework Search Paths
    

    TARGET:my_project
    $(inherited)
    "$(SRCROOT)"
    "$(SRCROOT)/my_project"
    
    TEST:my_projectTests
    "$(SDKROOT)/Developer/Library/Frameworks"    <

    Note: If you drag a framework into XCode. XCode 5 has bad habit of hardcoding the path

    /Users/gbxc/Documents/my_project
    

    should be

    "$(SRCROOT)"                             << Documents/my_project
    "$(SRCROOT)/my_project"                  << Documents/my_project/my_project
    

    so if you moved your project might get problems

    Best way to check whats correct is to create a new single view project that runs tests ok.

    Run the Test action
    By default it fails but at least testing is running
    then compare the  Framework Search Paths.
    

提交回复
热议问题