News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Listing warnings

Started by smallB, October 31, 2011, 03:56:47 PM

Previous topic - Next topic

smallB

Guys, I've tried to look all over the cb in order to find a window which would show warnings from building a project but I couldn't find one.
Does cb provides such window or in order to see those (potential) warnings I have to go to build.log?
Thanks?

zabzonk

View|Logs and then Build Messages? Unless you have closed that tab, in which case you can reopen it by right-clicking a tab and selecting Toggle...

smallB

#2
Thanks Neil, but this doesn't work - not in this scenario anyway:
int f()
{


}
int main()
{
    f();
    return 0;
}

This with -Wall will emit a warning about no return statement, but ONLY visible in build log.html.

oBFusCATed

See this http://www.codeblocks.org/images/stories/imagebrowser/cb_debugging.png
There are both "Build log" and "Build messages" at the bottom of the screen shot.
If you don't see warnings/errors there, then something is broken.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

smallB

Hi, I've checked that already - nothing there indicating that there could be any warnings. But build.log.html lists this warning.

zabzonk

See http://imgur.com/3e9hQ

I suppose you have enabled -Wall in the CB project settings?


smallB

Hi Neil, yes, I have it set. The output from a program (in cb in build log tab):

int f()
{
}

int main()
{
f();
}


is:
Checking for existence: C:\c++ excercizes\no_return\bin\Debug\no_return.exe
Executing: "E:\downloads\codeblocks\Nightly\oct_2011\CB_20111030_rev7550_DEBUGGER_BRANCH_win32/cb_console_runner.exe" "C:\c++ excercizes\no_return\bin\Debug\no_return.exe"  (in C:\c++ excercizes\no_return\.)
Process terminated with status 0 (0 minutes, 2 seconds)

In the file build.log.html:
Build started on: 01-11-2011 at 09:08.37
Build ended on: 01-11-2011 at 09:08.42

-------------- Build: Debug in no_return ---------------
g++ -std=c++0x -Wfatal-errors -Wextra -Wall -fexceptions -g -std=c++0x -Wfatal-errors -Wextra -Wall -g -Wreorder -ID:\Libraries\boost_1_47_0\boost_1_47_0 -ID:\Libraries\Art_lib -I"C:\c++ excercizes\no_return" -I"C:\c++ excercizes\no_return" -c "C:\c++ excercizes\no_return\main.cpp" -o obj\Debug\main.o
C:\c++ excercizes\no_return\main.cpp: In function 'int f()':
C:\c++ excercizes\no_return\main.cpp:7:1: warning: no return statement in function returning non-void [-Wreturn-type]
mingw32-g++.exe -LC:\boost_1_47_0 -LC:\Qt\4.8.0\bin -o bin\Debug\no_return.exe obj\Debug\main.o
Output size is 57.41 KB
Process terminated with status 0 (0 minutes, 4 seconds)
0 errors, 1 warnings (0 minutes, 4 seconds)

zabzonk

If your code compiled with warnings,  but with zero errors, it is not by default re-built the next time you hit "run", so you won't see the warnings a second time. To see the warnings again, you need to explicitly rebuild.  The stuff in the build-log is from the last compilation.

smallB

Neil, thanks, indeed rebuild does the trick.