2012-03-05 24 views
6

私はC++でATL COM dllで作業しています。ライブラリを使用しようとすると、min/maxに関連するエラーが多数発生します。私は彼らがこれに関連していると想像していますが、それはまた、他の多くのエラーを引き起こすようです。警告C4003:マクロ 'min'の実際のパラメータが不十分です

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

このヘッダーでインラインマクロは次のように定義されます。とにかく

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

、私はこの問題を議論し、私が使用できることを示していることをここに投稿の数を読んだことがある

#define NOMINMAX before #include "windows.h" 

これはうまくいかず、まだエラーが出ます。私はそれが大きいので、ライブラリを変更する必要はありませんし、むしろ自分のプロジェクトはカスタマイズされたライブラリに依存する必要はないので、私は私のDLLコード内で処理できるいくつかの並べ替えの方法を好むだろう。他に何ができますか?

答えて

8

「windows.h」を直接含む前に#define NOMINMAXを置いていますが、それを含む他のヘッダの前に置いていないのでしょうか?ソースファイルの最初の部分で移動してみてください。

+0

私はこれを試しました。 window.hが含まれている唯一の場所は、自動的に生成されたヘッダーファイル内にあるため、そこの変更はすべて削除されます。私は#define NOMINMAXをクラスヘッダーファイルに追加してから、この自動的に作成されたヘッダーファイルをインポートし、その特定のエラーはなくなりました。今、私は、メモリが足りなくなり、コマンドラインで/ Zmオプションを使用するように頼まれたという問題が残されています。しかし、それは私が解決する必要がある別の問題です。 – Travis

関連する問題