致电 C++ main.mm 中的库导致编译错误 - 验证声明与宏冲突

发布于 2024-12-29 10:40:32 字数 854 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情释 2025-01-05 10:40:33
Macro "verify" passed 4 arguments, but takes just 1

意味着某处有一个#define verify(x) ...。它在 C++ 中没有保留,但您所包含的内容正在定义它。

快速

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

除了很多其他事情之外,

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

产生的结果是,在包含了所需的所有 OS X/iOS 标头之后,在包含 bdb 之前进行 #undef verify 应该是安全的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文