gpt4 book ai didi

c++ - 警告 C4003 : not enough actual parameters for macro 'min'

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:25:23 24 4
gpt4 key购买 nike

我正在使用 C++ 编写 ATL COM dll,当我尝试使用一个库时,我遇到了一些与最小值/最大值相关的错误,例如这个。它似乎也导致了许多其他错误,尽管我认为它们与此有关。

1>stdafx.cpp
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : warning C4003: not enough actual parameters for macro 'min'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(366) : warning C4003: not enough actual parameters for macro 'min'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(372) : warning C4003: not enough actual parameters for macro 'max'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : warning C4003: not enough actual parameters for macro 'max'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(378) : warning C4003: not enough actual parameters for macro 'max'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2059: syntax error : '('
1> c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(413) : see reference to class template instantiation 'OpenMS::DPosition<D>' being compiled
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2059: syntax error : ')'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2143: syntax error : missing ')' before '?'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2143: syntax error : missing ';' before '?'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2574: 'OpenMS::DPosition<D>::DPosition(void)' : cannot be declared static
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2059: syntax error : '('
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2059: syntax error : ')'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2143: syntax error : missing ')' before '?'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2143: syntax error : missing ';' before '?'
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2574: 'OpenMS::DPosition<D>::DPosition(void)' : cannot be declared static
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(376) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\dropbox\openms-1.6.0\include\openms\datastructures\dposition.h(364) : error C2059: syntax error : '('

此 header 中的内联宏定义为:

    /// 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++ - 警告 C4003 : not enough actual parameters for macro 'min' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9562356/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com