警告 C4003:宏"min"的实际参数不足
warning C4003: not enough actual parameters for macro 'min'
我正在c++中处理ATL COM dll,当我试图使用库时,我会遇到许多与min/max相关的错误,比如这样。它似乎还导致了许多其他错误,尽管我认为它们与此有关。
1>stdafx.cpp
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : warning C4003: not enough actual parameters for macro 'min'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(366) : warning C4003: not enough actual parameters for macro 'min'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(372) : warning C4003: not enough actual parameters for macro 'max'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : warning C4003: not enough actual parameters for macro 'max'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(378) : warning C4003: not enough actual parameters for macro 'max'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2059: syntax error : '('
1> c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(413) : see reference to class template instantiation 'OpenMS::DPosition<D>' being compiled
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2059: syntax error : ')'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2143: syntax error : missing ')' before '?'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2143: syntax error : missing ';' before '?'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2574: 'OpenMS::DPosition<D>::DPosition(void)' : cannot be declared static
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2059: syntax error : '('
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2059: syntax error : ')'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2143: syntax error : missing ')' before '?'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2143: syntax error : missing ';' before '?'
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2574: 'OpenMS::DPosition<D>::DPosition(void)' : cannot be declared static
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(376) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:dropboxopenms-1.6.0includeopenmsdatastructuresdposition.h(364) : error C2059: syntax error : '('
此标头中的内联宏定义为:
/// smallest positive
inline static const DPosition
min()
{
return DPosition(std::numeric_limits<typename DPosition::CoordinateType>::min());
}
不管怎样,我在这里读了很多关于这个问题的帖子,并表示我可以使用
#define NOMINMAX before #include "windows.h"
然而,这并没有起作用,我仍然会收到错误。我不想修改库,因为它很大,我也不想让我的项目依赖于自定义库,所以我更喜欢在dll代码中处理的某种解决方案。我还能做什么?
也许您将#define NOMINMAX放在直接包含"windows.h"之前,而不是放在包含它的其他标头之前?尝试将其移动到源文件的同一个开头(如果没有)。
相关文章:
- 如何反转整数参数包
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 如何使用默认参数等选择模板专业化
- 模板参数替换失败,并且未完成隐式转换
- 具有默认模板参数的多态类的模板推导失败
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 函数调用中参数的顺序重要吗
- 部分定义/别名模板模板参数
- 使用`std :: min`作为算法参数
- std::min 与参数包
- 在调试中,如何知道对函数的重复调用中参数的统计数据(max-min,average,distribution..)
- ESP8266错误:宏"min"传递了 3 个参数,但只需要 2 个参数
- 任何人都可以解决此GCC编译器错误:宏"min"传递了3个参数,但只需要两个参数
- 错误 C2782:"常量_Ty &std::min(常量 _Ty &,常量_Ty &)":模板参数"_Ty"不明确
- 警告 C4003:宏"min"的实际参数不足
- 为什么 std::min(std::initializer_list<T>) 按值接受参数?
- 为什么小于操作符接受不同类型的参数,而std::min不接受
- Arm-linux-androideabi-gcc:在传递-mmacosx-version-min参数时获得无法识别的命
- 如何在可变参数包中找到"min"类型?