Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fredrum

macrumors newbie
Original poster
Dec 14, 2008
11
0
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?



cheers
fred
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
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

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.
 

fredrum

macrumors newbie
Original poster
Dec 14, 2008
11
0
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. :)

cheers
fred
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.