Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » (Fixed) Enable g++ compiler warnings
(Fixed) Enable g++ compiler warnings [message #1814425] Wed, 11 September 2019 05:23 Go to next message
Eclipse UserFriend
Hi,

I'm working in multiple C++ projects in one workspace. All projects are not managed by Eclipse. They are imported as "Existing Code as Makefile Project".

The projects are packaged and built by Maven. Maven calls make at some point. make calls g++ with

-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wlogical-op -Wuseless-cast -Wdouble-promotion -Wformat=2


Now I've noticed that sometimes, probably after the build, Eclipse displays compiler warnings. I think the warnings are somehow read from the artifacts. I'm talking about warnings like:


  • conversion to 'int' from 'mytype {aka unsigned int}' may change the sign of the result [-Wsign-conversion]
  • conversion to 'int' from 'double' may alter its value [-Wconversion]
  • 'var' should be initialized in the member initialization list [-Weffc++]


After I clean a project that displayed these warnings the warnings are gone. I have to build that project to get these warnings back. But it does not work for most projects. Only some projects display these warnings.

How can I enable these warnings for all projects?

index.php/fa/36270/0/
  • Attachment: warnings.png
    (Size: 56.72KB, Downloaded 791 times)

[Updated on: Wed, 11 September 2019 06:46] by Moderator

Re: Enable g++ compiler warnings [message #1814428 is a reply to message #1814425] Wed, 11 September 2019 06:43 Go to previous message
Eclipse UserFriend
Ok, I found my error. Eclipse parses the log output of the build process and displays the found warnings and errors after the build. In most cases I opened a terminal and built in the terminal. In that case Eclipse isn't able to parse the output, of course. Now I know that I have to build all projects with Eclipse.

I didn't know that Eclipse parses the log output. After I know it I see how stupid it was to build from terminal.

[Updated on: Wed, 11 September 2019 06:45] by Moderator

Previous Topic:Compiler intrinsic #defines not recognized by text editor for AVX2
Next Topic:unresolved inclusion
Goto Forum:
  


Current Time: Mon Jun 30 23:14:18 EDT 2025

Powered by FUDForum. Page generated in 0.03699 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top