Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

warnings in wxWindows with mingw

0 views
Skip to first unread message

John Ratliff

unread,
Oct 12, 2004, 9:47:25 PM10/12/04
to
I thought I just posted this, but it mysteriously disappeared. If it happens
again, I'll assume some administrator is trying to tell me something and I
won't repost. But I don't know what that would be, so here goes.

When I compile my program in mingw using wxWidgets 2.4 (I've also tried
wxWidgets 2.5.3 with no better results), I get tons of warning messages.

My program builds fine, but I can't see any legitimite warning messages for
all the extraneous ones.

The majority look like this:
c:/MinGW/include/wx/msw/palette.h:57: warning: inline function 'WXHPALETTE
wxPalette::GetHPALETTE() const' is declared as dllimport: attribute ignored

The only warning messages I get with wxGTK in gentoo/linux are a few unused
variable warnings.

I have attached my build log at http://games.technoplaza.net/wx/build.log
It's about 3 MB.

I am using mingw/msys. I build wxWidgets using the following command
./configure --prefix=/mingw && make && make install

I have gcc/g++ 3.4.2 and the mingw runtime 3.5.

The build log I had with 2.5.3 was around 5 MB, but I no longer have that
file.

I posted a message on the phpBB, but I was told I might get a better
response here.

I wanted to use 2.5.3 because I was told there was support for precompiled
headers.
If it was using precompiled headers, would that mean it wouldn't reevalutate
these headers and in theory, I should not get the warnings?

When I build 2.5.3, I had .gch files. But they were all in the wxWidgets
directory. They were not put in the /mingw. So I don't think gcc knew about
them. There was no reference to them in wx-config --cxxflags either. But I
am not at all familiar with PCH. So maybe I am wrong in all these things.

My source code (GPL) is available at
http://games.technoplaza.net/CHTDecoder/wx/wxCHTDecoder-src.tar.bz2 if
anyone wants to try and compile it for themselves.

--John Ratliff


Julian Smart

unread,
Oct 13, 2004, 2:26:47 AM10/13/04
to
At 02:47 13/10/2004, you wrote:

>I thought I just posted this, but it mysteriously disappeared. If it happens
>again, I'll assume some administrator is trying to tell me something and I
>won't repost. But I don't know what that would be, so here goes.

I see both of your posts.

>When I compile my program in mingw using wxWidgets 2.4 (I've also tried
>wxWidgets 2.5.3 with no better results), I get tons of warning messages.
>
>My program builds fine, but I can't see any legitimite warning messages for
>all the extraneous ones.
>
>The majority look like this:
>c:/MinGW/include/wx/msw/palette.h:57: warning: inline function 'WXHPALETTE
>wxPalette::GetHPALETTE() const' is declared as dllimport: attribute ignored

It looks as if wxWidgets is being built as a shared library; you
could try using --disable-shared. Of course, that's not much help
if you really need to build the DLL version, and we should
figure out how to get rid of the warning anyway. I can't quite believe
we need to eliminate inline functions for all exported classes...
I'm not sure whether Mingw is saying it's ignoring 'dllimport', or 'inline',
presumably 'dllimport'. Anyway, if this is harmless, we can find out
how to suppress the warning.

Regards,

Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
For additional commands, e-mail: wx-use...@lists.wxwidgets.org

John Ratliff

unread,
Oct 13, 2004, 11:15:52 AM10/13/04
to
>>I thought I just posted this, but it mysteriously disappeared. If it
>>happens
>>again, I'll assume some administrator is trying to tell me something and I
>>won't repost. But I don't know what that would be, so here goes.
>
> I see both of your posts.

Outlook express told me "My message is no longer available on the server".
Never seen that before. But OE6 is horrible. I just didn't want to go find
and install a newsreader when I don't use Newsgroups. (I guess this is a
mailing list for you, but I don't like mailing lists).

>
>>When I compile my program in mingw using wxWidgets 2.4 (I've also tried
>>wxWidgets 2.5.3 with no better results), I get tons of warning messages.
>>
>>My program builds fine, but I can't see any legitimite warning messages
>>for
>>all the extraneous ones.
>>
>>The majority look like this:
>>c:/MinGW/include/wx/msw/palette.h:57: warning: inline function 'WXHPALETTE
>>wxPalette::GetHPALETTE() const' is declared as dllimport: attribute
>>ignored
>
> It looks as if wxWidgets is being built as a shared library; you
> could try using --disable-shared. Of course, that's not much help
> if you really need to build the DLL version, and we should
> figure out how to get rid of the warning anyway. I can't quite believe
> we need to eliminate inline functions for all exported classes...
> I'm not sure whether Mingw is saying it's ignoring 'dllimport', or
> 'inline',
> presumably 'dllimport'. Anyway, if this is harmless, we can find out
> how to suppress the warning.

I would prefer the shared library. Would hate to have 10 or 15 programs that
include 10 or 15 copies of wxWidgets inside.

It seems to be harmless. I have noticed no problems running my application.

Thanks,

--John Ratliff


Vadim Zeitlin

unread,
Oct 13, 2004, 5:48:42 PM10/13/04
to
On Wed, 13 Oct 2004 01:47:25 GMT John Ratliff <jdra...@indiana.edu> wrote:

JR> When I compile my program in mingw using wxWidgets 2.4 (I've also tried
JR> wxWidgets 2.5.3 with no better results), I get tons of warning messages.
...
JR> The majority look like this:
JR> c:/MinGW/include/wx/msw/palette.h:57: warning: inline function 'WXHPALETTE
JR> wxPalette::GetHPALETTE() const' is declared as dllimport: attribute ignored

What if you remove the explicit (but useless) inline from GetHPALETTE()
declaration? Does it still happen?

Anyhow, I don't think the compiler is right to give these warnings. I'd
say that this is a mingw32 problem and that it should be fixed in their
next release (as it didn't exist in the previous ones AFAIK), please report
it to mingw folks.

JR> I wanted to use 2.5.3 because I was told there was support for precompiled
JR> headers.

It is still experimental in the best case...

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

John Ratliff

unread,
Oct 15, 2004, 10:21:10 PM10/15/04
to
Vadim Zeitlin wrote:
> On Wed, 13 Oct 2004 01:47:25 GMT John Ratliff <jdra...@indiana.edu> wrote:
>
> JR> When I compile my program in mingw using wxWidgets 2.4 (I've also tried
> JR> wxWidgets 2.5.3 with no better results), I get tons of warning messages.
> ...
> JR> The majority look like this:
> JR> c:/MinGW/include/wx/msw/palette.h:57: warning: inline function 'WXHPALETTE
> JR> wxPalette::GetHPALETTE() const' is declared as dllimport: attribute ignored
>
> What if you remove the explicit (but useless) inline from GetHPALETTE()
> declaration? Does it still happen?

I don't think this will satisfy. I haven't tried it, but let me show you
a similar warning with a different signature.

c:/MinGW/include/wx/dnd.h:175: warning: inline function 'virtual void
wxDropTargetBase::OnLeave()' is declared as dllimport: attribute ignored.

There is no explicit inline on that function. It is implicitly inline.
So I think the problem is related to the dllimport.

>
> Anyhow, I don't think the compiler is right to give these warnings. I'd
> say that this is a mingw32 problem and that it should be fixed in their
> next release (as it didn't exist in the previous ones AFAIK), please report
> it to mingw folks.

Maybe you could explain something to me first. dllimport with an inline
function makes no sense to me. How can a function be both inline and a
DLL call? It should be one or the other, right?. So all the inline
functions where the classes are declared DLLIMPORT seem to have a
meaningless attribute.

Does this not suggest that the warnings are indeed valid, albeit
meaningless? Even if previous versions of gcc (such as mingw/gcc 3.2.3)
do not flag this, are you sure that means mingw is wrong?

--John Ratliff

Vadim Zeitlin

unread,
Oct 16, 2004, 7:23:42 AM10/16/04
to
On Sat, 16 Oct 2004 02:21:10 GMT John Ratliff <jdra...@indiana.edu> wrote:

JR> > Anyhow, I don't think the compiler is right to give these warnings. I'd
JR> > say that this is a mingw32 problem and that it should be fixed in their
JR> > next release (as it didn't exist in the previous ones AFAIK), please report
JR> > it to mingw folks.
JR>
JR> Maybe you could explain something to me first. dllimport with an inline
JR> function makes no sense to me. How can a function be both inline and a
JR> DLL call?

Even if it can't, it is stupid for the compiler to complain about it -- it
should simply ignore dllimport if it inlines the function. The reason is
that otherwise it is impossible to have inline functions in a dllexported
class and this surely can't be intentional.

Besides, I _think_ that the compiler generates out of line copy of
dllexported function anyhow, in case it can't inline it (for example
because inlining is disabled) when compiling the DLL client. I'm not sure
about this but a quick nm should be enough to verify it.

JR> It should be one or the other, right?. So all the inline functions
JR> where the classes are declared DLLIMPORT seem to have a meaningless
JR> attribute.

Again, I might agree with this if the function had been explicitly
exported (although even then there is no way to really know for the
programmer whether the function is going to be really inlined or not and
hence no way whether he should use dllexport or not). But it isn't, the
whole class is and in this situation the warning doesn't make any sense
whatsoever.

JR> Does this not suggest that the warnings are indeed valid, albeit
JR> meaningless? Even if previous versions of gcc (such as mingw/gcc 3.2.3)
JR> do not flag this, are you sure that means mingw is wrong?

Yes, quite.

John Ratliff

unread,
Oct 16, 2004, 10:11:31 AM10/16/04
to
Vadim Zeitlin wrote:
> On Sat, 16 Oct 2004 02:21:10 GMT John Ratliff <jdra...@indiana.edu> wrote:
>
> JR> > Anyhow, I don't think the compiler is right to give these warnings. I'd
> JR> > say that this is a mingw32 problem and that it should be fixed in their
> JR> > next release (as it didn't exist in the previous ones AFAIK), please report
> JR> > it to mingw folks.
> JR>
> JR> Maybe you could explain something to me first. dllimport with an inline
> JR> function makes no sense to me. How can a function be both inline and a
> JR> DLL call?
>
> Even if it can't, it is stupid for the compiler to complain about it -- it
> should simply ignore dllimport if it inlines the function. The reason is
> that otherwise it is impossible to have inline functions in a dllexported
> class and this surely can't be intentional.

I think I forgot to mention I only get these warnings with the -W flag
on. So I asked for warnings, even if they are meaningless.

I don't think it is saying it cannot ignore inline rather than dllimport
if inlining were disabled, only that because I don't have inlinig
disabled, this particular dllimport is meaningless and in this context
is being ignored, which is good, and just what we want.

I want warnings, so I can see the warnings in my program, but they are
obscured by these warnings.

I just want to disable this particular warning.

Sorry for not mentioning this earlier. I didn't think about it until I
was starting to email the mingw people.

--John Ratliff

Vadim Zeitlin

unread,
Oct 16, 2004, 10:20:07 AM10/16/04
to
On Sat, 16 Oct 2004 14:11:31 GMT John Ratliff <jdra...@indiana.edu> wrote:

JR> I think I forgot to mention I only get these warnings with the -W flag
JR> on. So I asked for warnings, even if they are meaningless.

But not for the warnings which can't be fixed!

JR> I just want to disable this particular warning.

This particular warning should have never existed because, once again,
there is no way to fix it *and* nobody cares.

John Ratliff

unread,
Oct 16, 2004, 10:42:03 AM10/16/04
to
Vadim Zeitlin wrote:
> On Sat, 16 Oct 2004 14:11:31 GMT John Ratliff <jdra...@indiana.edu> wrote:
>
> JR> I think I forgot to mention I only get these warnings with the -W flag
> JR> on. So I asked for warnings, even if they are meaningless.
>
> But not for the warnings which can't be fixed!
>
> JR> I just want to disable this particular warning.
>
> This particular warning should have never existed because, once again,
> there is no way to fix it *and* nobody cares.
>

Should I report this as a GCC bug then? Here is what the GCC 3.4.2
manual states:

"On Microsoft Windows targets, the dllimport attribute causes the
compiler to reference a function or variable via a global pointer to a
pointer that is set up by the Microsoft Windows dll library. The pointer
name is formed by combining _imp__ and the function or variable name.
The attribute implies extern storage.

Currently, the attribute is ignored for inlined functions. If the
attribute is applied to a symbol definition, an error is reported. If a
symbol previously declared dllimport is later defined, the attribute is
ignored in subsequent references, and a warning is emitted. The
attribute is also overridden by a subsequent declaration as dllexport. "

http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Function-Attributes.html#Function-Attributes

And I can find no switch to disable this warning.

I agree with you. The warning does not seem to be fixable, and therefore
should not exist (or in the least be suppressable -- I'd be happy with
that).

--John Ratliff

Vadim Zeitlin

unread,
Oct 16, 2004, 12:34:51 PM10/16/04
to
On Sat, 16 Oct 2004 14:42:03 GMT John Ratliff <jdra...@indiana.edu> wrote:

JR> Should I report this as a GCC bug then?

I think you should do it (after checking in their ML archives if it hasn't
been already discussed).

John Ratliff

unread,
Oct 16, 2004, 10:05:35 PM10/16/04
to
Vadim Zeitlin wrote:
> On Sat, 16 Oct 2004 14:42:03 GMT John Ratliff <jdra...@indiana.edu> wrote:
>
> JR> Should I report this as a GCC bug then?
>
> I think you should do it (after checking in their ML archives if it hasn't
> been already discussed).
>
> Regards,
> VZ
>

Seems I am not the only one with such warning problems...

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477

Thanks VZ,

--John Ratliff

0 new messages