views:

654

answers:

1

I'm using mingw32-make to compile a qt project that uses opengl, it compiles correctly and everything, but it spits countless warning messages of the form:

c:/qt3/include/qcolor.h:67: warning: inline function `int qGray(int, int, 
int)' declared as dllimport: attribute ignored

For this particular instance, the function declaration is:

Q_EXPORT inline int qGray( int r, int g, int b )// convert R,G,B to gray 0..255
{ return (r*11+g*16+b*5)/32; }

My question is, why is it spitting all these warning? how can I silence them without silencing other legitimate warnings (i.e. warnings that are related directly to my code and could be potential problems)?

More importantly, why is mingw ignoring the dll import attribute in the first place?

A: 

I think Qt ought to only define Q_EXPORT (Q_DECL_EXPORT in Qt 4) to be the dllexport/import attribute if one of the following macros is defined, so make sure your makefiles or code that includes Qt headers (which eventually will include qglobal.h) aren't defining any of them: WIN32, _WIN32, WIN32, WIN64, _WIN64, WIN64. Or you can just define Q_EXPORT to be nothing in your compile (or preprocessor) flags, then Qt should skip defining it.

Reed Hedges

related questions