User forums > Help

Code::Blocks not showing warnings

(1/2) > >>

mgoyanes:
Hi.

I'm on Win 7 64 bits and just installed codeblocks-10.05mingw-setup.exe.

In Settings->Compiler and debbuger I've set the flags -ansi -Wall and -pedantic to show me all the warnings.
If I use this code and press F9 the program runs all the way and does not show me any warnings.
On the other and, if I press Ctrl+F11 (rebuild) now, on the build message log It shows the warning I was expecting

--- Quote ---main.c||In function 'main':|
main.c|6|warning: unused variable 'c'|
||=== Build finished: 0 errors, 1 warnings ===|
--- End quote ---


Wasn't expected that the program didn't run and show me the exact same message as when doing rebuild?

What can I do to this warnings show when I press F9?

Regards,

mgoyanes


--- Code: ---#include <stdio.h>
#include <stdlib.h>

int main()
{
    int c;
    printf("Hello world!\n");
    return 0;
}


--- End code ---

MortenMacFly:

--- Quote from: mgoyanes on February 21, 2012, 07:29:27 pm ---Wasn't expected that the program didn't run and show me the exact same message as when doing rebuild?

--- End quote ---
No.

Run = Run a previously compiled program.
Build = Compile all files that have changed in their sources or new files that haven't been compiled at all.
Build + Run = Combination of above.
Re-Build = Remove all previously compiled files and re-build them all.

You'll see compiler warnings only when you compile a file.

So if you hit just run there is no build at all. If you hit build and you didn't change the source file which causes the warning you won't see it again until you either change the source code or hit re-build.

It's by design and pretty much the same for every IDE.

mgoyanes:
Thanks.

Made a new project with the exact same code.

As you explained, now if I pressed F9 (build and run) warning should appear? Right?
But not. Its the exact same situation. Warnings appear only with F11

mgoyanes:
Just one more thing.

Now I realized, if for example, i change the name of my int variable and then press f9, on the build message log nothing appears (only when I press F11) but on the build log, a warning appears saying that the variable it's not used. but its extremely fast fast and then it's substituted by:


--- Quote ---Checking for existence: G:\Miguel\LEI\3 Ano\2 Semestre\PPP\Práticas\Ficha01\testes3\bin\Debug\testes3.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "G:\Miguel\LEI\3 Ano\2 Semestre\PPP\Práticas\Ficha01\testes3\bin\Debug\testes3.exe"  (in G:\Miguel\LEI\3 Ano\2 Semestre\PPP\Práticas\Ficha01\testes3\.)

--- End quote ---


and cmd shows the print message

Jenna:
If you do build and run, and build was successful, the build log will be cleared before running the app.
That's how C::B is designed.
You can go to "Settings -> Compiler and debugger -> [your compiler] -> Other settings" and check "Save build log to HTML when build is finished" and to get a more meaningful output "Always output the full commandline in the generated HTML file".

<Note_for_nightly_build_users>
    On newer revision these ooptions are on the tab "Build options"
</Note_for_nightly_build_users>

The HTML-file is generated in the same folder where the project-file is.

Or just build the project without directly running it (Ctrl+F9) .

Navigation

[0] Message Index

[#] Next page

Go to full version