N_A
N_A

Reputation: 19897

Call C++ library from main.mm results in compile error - verify declaration conflicts with macro

I have the following code in a header included in main.mm:

1.  virtual int truncate(DbTxn *, u_int32_t *, u_int32_t);
2.  virtual int upgrade(const char *name, u_int32_t flags);
3.  virtual int verify(
4.      const char *, const char *, __DB_STD(ostream) *, u_int32_t);

The first two lines are for context and to show what is working. The third and fourth lines have the following errors:

Macro "verify" passed 4 arguments, but takes just 1

'verify' declared as a 'virtual' field

If I add a random character to the end of the verify declaration like verityx then the file compiles without a problem. Is verify reserved?

Edit: My main.mm file:

#import <Foundation/Foundation.h>

#import "db_cxx.h"

int main (int argc, const char * argv[])
{

    return 0;
}

Edit 2:

The only two uses of the word "verify" in the berkeley header are:

virtual int log_verify(DB_LOG_VERIFY_CONFIG *);

virtual int verify(
    const char *, const char *, __DB_STD(ostream) *, u_int32_t);

Upvotes: 0

Views: 368

Answers (1)

smparkes
smparkes

Reputation: 14063

Macro "verify" passed 4 arguments, but takes just 1

means that there's a #define verify(x) ... somewhere. It's not reserved in C++ but something you're including is defining it.

A quick

fgrep -r verify /usr/include | fgrep '#define'

yields, amongst a lot of other things,

/usr/include/AssertMacros.h:        #define verify(assertion) __Verify(assertion)

After you've included all the OS X/iOS headers you need, it should be safe to #undef verify before including bdb.

Upvotes: 2

Related Questions