【问题标题】:OpenMesh does not compile with min/max macros activeOpenMesh 不会在激活最小/最大宏的情况下编译
【发布时间】:2015-07-22 14:31:44
【问题描述】:

我该如何处理这个错误?我将 NOMINMAX 添加到预处理器定义中,但它不起作用。那么解决办法是什么?

错误如下。

ClCompile:
1>  tricall.c
1>  Detected min macro! OpenMesh does not compile with min/max macros active! Please add a define NOMINMAX to your compiler flags or add #undef min before including OpenMesh headers !
1>d:\programfiles\c_library\openmesh3.2\include\openmesh\core\system\config.h(72): fatal error C1189: #error :  min macro active

【问题讨论】:

  • 请把你写的代码贴出来,如果没有看到你的代码,通常是不可能回答问题的。

标签: c++ c macros


【解决方案1】:

你应该添加

#ifdef min
#undef min
#endif

在包含 OpenMesh 标头之前,max 与此类似。

一些不遵守 NOMINMAX 的标头正在定义它们。

如果这破坏了依赖这些宏的其他代码,则使用更复杂的代码

#ifdef min
#define foo min
#undef min
#endif
/*OpenMesh includes here*/
#ifdef foo
#define min foo
#undef foo
#endif

foo 是您选择的符号。

【讨论】:

    猜你喜欢
    • 2020-12-22
    • 1970-01-01
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 2015-06-21
    • 2011-12-27
    • 2016-09-29
    • 2021-11-13
    相关资源
    最近更新 更多