Newbie Xcode Link problem

Discussion in 'Mac Programming' started by fredrum, Dec 14, 2008.

  1. fredrum macrumors newbie

    Dec 14, 2008
    Hi All,

    I am sure this is a really stupid question but if anyone can tell me what I might be doing wrong, I'd be really greatful.

    I am using Xcode to try and compile an example included in a SDK. The sdk only uses one .a static library file and one header file.
    Included is another .h file that "(no need to directly include this)"

    In Xcode I made a C++ 'Command Line Utility'. The Build Config is set to 1386 archiotecture and Mac OS X 10.4 Base SDK.

    It seems to me that it compiles ok but in the link phase I get the error message:

    Undefined symbols:
    "_MPProcessors", referenced from:
    REDCORE::pAL::GetNumberOfProcessors() in R3DSDKv1.a(R3DSDKv1.a-i386-master.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    But I can't find any of the above in the .h file or the short .cpp file.

    Would anyone be able to guess what might be going on here?

  2. gnasher729 macrumors P6


    Nov 25, 2005
    It looks like the library you are using uses a function that is not part of your programming. Most likely it is in one of the frameworks that come with the operating system; otherwise that SDK would have never worked. So here is what you do:

    1. What is the name of the function that is missing? The linker tells you: It is MPProcessors.

    2. In which header file is it declared? Do Command-Space, type in MPProcessors, Spotlight finds a few files, and eventually you figure out it is in Multiprocessing.h.

    3. If you open the file and look where it is located (Command-click on the window title), you find it is within the CarbonCore framework inside the CoreServices framework.

    4. Add the Framework: Add to project, then go to your hard drive -> System -> Library -> Frameworks and pick the CoreServices framework.
  3. fredrum thread starter macrumors newbie

    Dec 14, 2008
    Wicked!! Thank you very much Sir for that brilliant answer!

    It went through the build fine after adding 'CodeServices' as you said.
    And I learned a bit of problem solving, as an extra bonus.
    Can now go to sleep. :)


Share This Page