Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: larsjo on March 20, 2015, 04:26:06 pm

Title: missing warning messages
Post by: larsjo on March 20, 2015, 04:26:06 pm
I take this program, test.c:
int main(){ }
and compile with the command line:
$/cygdrive/c/Program\ Files/CodeBlocks/MinGW/bin/mingw32-gcc.exe   -Wall test.c
Then the following warning message shows:
test.c:1: warning: control reaches end of non-void function

This is all very well. However, when I compile the same code in Code::Blocks (v.10.05) it says "0 errors, 0 warnings". I do think this deserves a warning message, and it should show since CodeBlocks uses the same compiler as I did at the command line call.

I have checked the  -Wall  square at three locations:
The first two by going in to the menu bar: Project > Build options...
To the left I mark "Debug" and check the -Wall-square
and then I, to the left, mark the "root" and check the -Wall-square

Finally I once more go to the menu bar: Settings > Compiler and debugger...
and again I check the -Wall-square.

What more is necessary to make the warning show up?

Some warning messages show up anyway, but somehow not all those that should.





Title: Re: missing warning messages
Post by: oBFusCATed on March 20, 2015, 08:37:16 pm
Why don't you try some of the two newer versions of codeblocks (12.05 or 13.12)?
Title: Re: missing warning messages
Post by: larsjo on March 20, 2015, 08:50:14 pm
This is the version installed at my university.
Title: Re: missing warning messages
Post by: oBFusCATed on March 20, 2015, 08:51:50 pm
What is -WAll-square?

BTW: Tell them to update, it is almost free:)
Title: Re: missing warning messages
Post by: frithjofh on March 20, 2015, 09:02:23 pm
i think he means the tick-mark, where up enable/disable this option... its kind of square... the wxCheckBox
Title: Re: missing warning messages
Post by: larsjo on March 20, 2015, 09:06:00 pm
frithjofh is right. That is what i mean. The checkboxes.
Title: Re: missing warning messages
Post by: oBFusCATed on March 20, 2015, 09:25:37 pm
Hm, have you checked the full log?

See this page http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F to see how to enable it .

Inspect the log and see if the option is passed correctly. Keep in mind that if the compiler is newer than the release of CB it might not be fully supported, because its output has changed.
Title: Re: missing warning messages
Post by: larsjo on March 21, 2015, 07:13:40 am
I am at home now, but I have the same problem here. Anyway, I looked where oBFusCATed pointed and followed the advice. At the menu-bar I selected
Settings > Compiler and debugger...
I made sure that "Global compiler settings" was marked in the field to the left.  Then I selected the tab "Other settings". There I could set "Compiler logging" to "Full command line".

And it worked  :)

The command line statement was shown in the build log
(and it started with  gcc -Wall -g -Wall -g -Wall -g ...  so the checkboxes were thoroughly checked :)  )

And the warning message showed...

Many thanks to oBFusCATed.
Title: Re: missing warning messages
Post by: oBFusCATed on March 21, 2015, 11:28:17 am
Enabling the full logging should not magically make cb to show the warnings.
Do you see them in the build messages tab?
Title: Re: missing warning messages
Post by: larsjo on March 21, 2015, 11:39:07 am
Yes I do. The warnings are displayed both in "Build log" and in "Build messages".
Title: Re: missing warning messages
Post by: larsjo on March 23, 2015, 06:54:49 am
oBFusCATed was right in his/her last skeptical remark. At school i made the same change. The effect was that the command line options showed up in "Build messages". But the end result was "No errors, no warnings".

However, in "Global compiler settings" (reached through  "Settings > Compiler and debugger ..."), under the tab "Other options" I found some old leftovers. The option "-std=c99" was there, so I removed it. After that the warning was shown: "control reaches end of non-void function".

So now I am happy again. :)