Mac OS Framework header file MachineExceptions.h error : declaration does not declare anything

StackOverflow https://stackoverflow.com/questions/17031321

  •  31-05-2022
  •  | 
  •  

Domanda

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:

  1. I found out that Carbon Core has been deprecated in 10.8 (the version I'm using)- https://developer.apple.com/library/mac/#releasenotes/General/CarbonCoreDeprecations/ As a result, the MacTypes.h in the Carbon Core framework was rather anaemic, which conditionally included MacTypes.h from /usr/include/
  2. I've tried editing MacTypes.h (in the Carbon Core framework) and MachineExceptions.h to include MacTypes from /usr/include, per the information on the 'deprecated' page above.
  3. Switched around the order of including the header files (worked for someone else while I was researching this).
  4. I am including the CoreFoundation and ApplicationServices frameworks in my makefile (using the '-framework' option)

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!

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top