Background
I'm trying to use the LSGetApplicationForURL
API and found a very useful example here - how to get default mail client version on mac os x?
However, when I try to compile the code, I get this error:
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:53: error: declaration does not declare anything
When I opened up MachineExceptions around line 53, this is where I saw some declarations of unsignedwide
, which is a type that is defined in MacTypes.h
. I found out this was part of the Carbon Core framework.
For starters, I am only including the top-level headers in my code (in fact, using the exact sample code found in the example above). So, I'm not including / touching MachineException.h
or any of the other header files. Although, obviously there seems to be some dependencies that eventually lead to this error.
Some of the things I've tried / researched:
MacTypes.h
in the Carbon Core framework was rather anaemic, which conditionally included MacTypes.h
from /usr/include/MacTypes.h
(in the Carbon Core framework) and MachineExceptions.h to include MacTypes from /usr/include, per the information on the 'deprecated' page above.Any feedback on this issue is greatly appreciated as I've spent many hours trying to sort this out. I apologize in advance if anything in here is fundamental / basic. I am very new to Mac OS programming and trying to understand how Frameworks are wired, also how to use them.
Thanks!
The error you get seems like the result of some macro definition. Do you have LR
macro defined somewhere in your code or in preprocessor definitions in your project? Take a look at note in the line 42 of MachineExceptions.h about CR
. Looks like you have something similar.
Anyway I've successfully compiled the code in example with default command line tool project. So probably error in your project configuration.