致电 C++ main.mm 中的库导致编译错误 - 验证声明与宏冲突
我在 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);
前两行用于上下文并显示正在运行的内容。第三行和第四行有以下错误:
宏“验证”传递了 4 个参数,但只需要 1
“验证”声明为“虚拟”字段
如果我在验证声明的末尾添加一个随机字符(如 verityx
),那么该文件将在编译时不使用问题。 verify
是否已保留?
编辑: 我的 main.mm 文件:
#import <Foundation/Foundation.h>
#import "db_cxx.h"
int main (int argc, const char * argv[])
{
return 0;
}
编辑 2:
伯克利标题中“验证”一词的唯一两种用法是:
virtual int log_verify(DB_LOG_VERIFY_CONFIG *);
virtual int verify(
const char *, const char *, __DB_STD(ostream) *, u_int32_t);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
意味着某处有一个
#define verify(x) ...
。它在 C++ 中没有保留,但您所包含的内容正在定义它。快速
除了很多其他事情之外,
产生的结果是,在包含了所需的所有 OS X/iOS 标头之后,在包含 bdb 之前进行
#undef verify
应该是安全的。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
yields, amongst a lot of other things,
After you've included all the OS X/iOS headers you need, it should be safe to
#undef verify
before including bdb.