Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning C4003: not enough actual parameters for macro 'min'

I am working on an ATL COM dll in c++ and when I attempt to make use of a library I get a number of errors related to min/max such as this. It also seems to cause a number of other errors though I imagine they are related to this.

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 : '('

the inline macro in this header is defined as:

    /// smallest positive
    inline static const DPosition
    min()
    {
      return DPosition(std::numeric_limits<typename DPosition::CoordinateType>::min());
    }

Anyway, I have read a number of posts on here that discuss this problem and indicate that I can use

#define NOMINMAX before #include "windows.h"

however this did not work and I still get the errors. I do not want to have to modify the library as it is large and I would rather not have to have my project depend on a customized library so I would prefer some sort of solution that I can handle within my dll code. What else can I do?

like image 669
Travis Avatar asked Mar 05 '12 06:03

Travis


1 Answers

Maybe you placed #define NOMINMAX right before directly including "windows.h" but not before some other header which include it? Try moving it at the same beginning of the source file (if you didn't).

like image 50
peper0 Avatar answered Oct 20 '22 04:10

peper0