2012-03-05 18 views
6

C++ 'da bir ATL COM dll üzerinde çalışıyorum ve bir kütüphaneden faydalanmaya çalıştığımda, bu gibi min/maks ile ilgili bir dizi hata alıyorum. Ayrıca, bununla ilgili olduklarını hayal etsem de başka birtakım hatalara da neden oluyor gibi görünüyor.Uyarı C4003: Makro 'min' için yeterli gerçek parametre yok

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

bu başlıkta satır içi makro olarak tanımlanır: Neyse

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

, bu sorunu tartışmak ve ben kullanabileceği gösteriyor ki burada mesajların bir dizi okudum

#define NOMINMAX before #include "windows.h" 

Ancak bu işe yaramadı ve hala hataları alıyorum. Büyük olduğu için kütüphaneyi değiştirmek zorunda kalmak istemiyorum ve projem özel bir kütüphaneye bağlı kalmak zorunda kalmamayı tercih ediyorum, bu yüzden dll kodumda kullanabileceğim bir çözüm tercihini tercih ederim. Başka ne yapabilirim?

cevap

8

Belki de doğrudan "windows.h" dahil olmak üzere hemen önce NOMINMAX yerleştirdi, ancak dahil diğer bazı üstbilgilerden önce değil? Kaynak dosyanın aynı başında hareket etmeyi deneyin (yapmadıysanız).

+0

Sadece bunu denedim. Window.h adlı tek yer otomatik olarak oluşturulan bir başlık dosyasında yer alır, bu nedenle herhangi bir değişiklik yok edilir. Bu otomatik olarak oluşturulan üstbilgi dosyasını içe aktarmadan önce sınıf üstbilgisi dosyasına #define NOMINMAX ekledim ve bu özel hata gitti. Şimdi, bellek bitti ve komut satırında/Zm seçeneğini kullanmamı istedi bir sorun ile bıraktım. Ama bu benim çalışmak zorunda olduğum ayrı bir problem. – Travis

İlgili konular