[Xapian-discuss] Compiling Xapian within a Cocoa project
Olly Betts
olly at survex.com
Tue Apr 30 03:04:17 BST 2013
On Fri, Apr 26, 2013 at 07:56:59AM +0100, Olly Betts wrote:
> On Fri, Apr 26, 2013 at 08:45:49AM +0200, Tae Won Ha wrote:
> > In file included from /opt/local/include/xapian.h:34:
> > In file included from /opt/local/include/xapian/database.h:32:
> > In file included from /opt/local/include/xapian/document.h:33:
> > /opt/local/include/xapian/valueiterator.h:143:10: error: expected member name or ';' after declaration specifiers
> > bool check(Xapian::docid docid);
> > ~~~~ ^
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/AssertMacros.h:1291:28: note: expanded from macro 'check'
> > #define check(assertion) __Check(assertion)
> > ^
>
> Something in the OS X SDK is defining check() as a macro, which breaks
> any code after that which defines or declares a function or method
> called check().
>
> The simplest thing to do is to just include <xapian.h> *before* the
> problematic header.
It turns out that this check() macro is deprecated in favour of
__Check() - the old name is only supported for compatibility and is
due to be removed in a future OS X SDK release. Meanwhile you can
define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES to 0 to avoid
these compatibility macros, e.g. by adding this before you include any
OS X headers:
#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
That also has the benefit of ensuring you don't use these deprecated
macros in your code.
There's a full explanation in the comments here:
http://www.opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/AssertMacros.h
Cheers,
Olly
More information about the Xapian-discuss
mailing list