Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: smallB on October 31, 2011, 03:56:47 pm

Title: Listing warnings
Post by: smallB on October 31, 2011, 03:56:47 pm
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?
Title: Re: Listing warnings
Post by: zabzonk on October 31, 2011, 04:09:32 pm
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...
Title: Re: Listing warnings
Post by: smallB on October 31, 2011, 04:23:50 pm
Thanks Neil, but this doesn't work - not in this scenario anyway:
Code
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.
Title: Re: Listing warnings
Post by: oBFusCATed on October 31, 2011, 05:18:38 pm
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.
Title: Re: Listing warnings
Post by: smallB on October 31, 2011, 05:22:51 pm
Hi, I've checked that already - nothing there indicating that there could be any warnings. But build.log.html lists this warning.
Title: Re: Listing warnings
Post by: zabzonk on October 31, 2011, 05:41:15 pm
See http://imgur.com/3e9hQ

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

Title: Re: Listing warnings
Post by: smallB on November 01, 2011, 10:12:23 am
Hi Neil, yes, I have it set. The output from a program (in cb in build log tab):

Code
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)
Title: Re: Listing warnings
Post by: zabzonk on November 01, 2011, 10:30:24 am
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.
Title: Re: Listing warnings
Post by: smallB on November 01, 2011, 11:16:05 am
Neil, thanks, indeed rebuild does the trick.