Sto lavorando su una DLL ATL COM in C++ e quando tento di utilizzare una libreria ottengo un numero di errori relativi a min/max come questo. Sembra anche causare una serie di altri errori sebbene immagino che siano collegati a questo.avviso C4003: parametri non sufficienti per macro '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 : '('
la macro inline in questa intestazione è definito come:
/// smallest positive
inline static const DPosition
min()
{
return DPosition(std::numeric_limits<typename DPosition::CoordinateType>::min());
}
Comunque, ho letto una serie di messaggi su qui che discutere di questo problema e indicano che posso usare
#define NOMINMAX before #include "windows.h"
tuttavia questo non ha funzionato e ho ancora gli errori. Non voglio modificare la libreria in quanto è grande e preferirei non dover dipendere dal mio progetto su una libreria personalizzata, quindi preferirei una soluzione che possa essere gestita all'interno del mio codice dll. Cos'altro posso fare?
Ho appena provato questo. L'unico posto che window.h è incluso è all'interno di un file di intestazione generato automaticamente, quindi qualsiasi modifica lì è stata cancellata. Ho aggiunto #define NOMINMAX nel mio file di intestazione della classe prima di importare questo file di intestazione creato automaticamente e quell'errore particolare è andato via. Ora mi rimane un problema in cui ha esaurito la memoria e mi ha chiesto di usare l'opzione/Zm sulla riga di comando. Ma questo è un problema a parte che devo elaborare. – Travis