Reduce: wxWidgets warnings during compile (GCC 7)

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Ishtar
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon May 20, 2013 6:33 pm

Reduce: wxWidgets warnings during compile (GCC 7)

Post by Ishtar »

Dear All,

Recently, I have wanted to step-up GCC's compiler warnings for my application but have noticed that wxWidgets is quite noisy. I have tried various ways to ignore most of the warnings from wxWidgets includes (using pragma ignore etc) but this has been somewhat cumbersome.

I have therefore edited the wx-config script and replaced every instance of -I with -isystem. This seems to work very well, that is, only warnings in my code are flagged and nothing from wxWidgets. I would like to know if there are any caveats with this approach?

Any feedback on this approach would be appreciated.

Kind Regards
Amanda
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Reduce: wxWidgets warnings during compile (GCC 7)

Post by ONEEYEMAN »

Hi, Amanda,
How do you configure wxWidgets build? Please post the complete configure line including any and all environment variable settings.
Also, please post at least one example of the warning you see during the compile time.

Normally all those warnings should not occur as they are silenced by the wx-dev team, especially on *nix.

Thank you.
Ishtar
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon May 20, 2013 6:33 pm

Re: Reduce: wxWidgets warnings during compile (GCC 7)

Post by Ishtar »

Dear ONEEYEMAN,

Thank you for responding. I should have been slightly more specific, I was not talking about building the wxWidgets library itself but my own application which, of course, links against wx. However, to build wx I always use something like the following: (Fedora 25, wx-3.1, gcc-7.1).

Code: Select all

../configure --prefix=/usr/local/wx-3.1 --without-subdirs --disable-shared --with-gtk=2 --with-opengl
I was really referring to building my own application against wx. For example, I am using the GCC flag -Wconversion to trap any implicit conversions but when I do this I get lots of -Wconversion warnings from gdicmn.h. This happens with other warning flags too. To solve this I have edited wx-config and removed any instance of -I and replaced them with -isystem. It's my understanding that doing this causes the compiler to treat any library with -isystem as a system library and does not generate warnings. This approach seems to work, however, I was wondering if there were any issues in doing this.

Many thanks
Amanda
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: Reduce: wxWidgets warnings during compile (GCC 7)

Post by coderrc »

I prefer to do the -isystem in my makefile.
The biggest issue I see to your approach is portability. If you ever change your wx build, or build on a different machine, you will have to modify the wx-config again.
Ishtar
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon May 20, 2013 6:33 pm

Re: Reduce: wxWidgets warnings during compile (GCC 7)

Post by Ishtar »

Thanks coderrc,

On further testing, I did discovered a slight problem with this approach. I use Netbeans 8.2 for all my development work but changing to "-isystem" seemed to break wxWidgets code assistance functions. However, by manually adding the relevant includes in the Netbeans code assistance dialog, I was able to fix this problem.

Great! I can now compile my own applications with maximum warnings and have no warnings flagged from wxWidgets.

Amanda
Post Reply