Author Topic: Warnings and variables  (Read 6144 times)

Offline Eureka

  • Single posting newcomer
  • *
  • Posts: 8
Warnings and variables
« on: October 25, 2009, 11:59:03 am »
Hello, I'm a very beginner in computer programming and I have two questions with C::B :

1. When the program starts compiling, I can see some blue-written messages (the warnings) but when the compilation is over, they are erased. The problem is that I don't have the time to read the warnings as the compilation is very fast. How can I fix that ?
2. Is there a way for C::B to warn me that I don't use a variable I declared ? How ?

zabzonk

  • Guest
Re: Warnings and variables
« Reply #1 on: October 25, 2009, 12:42:58 pm »
To view the compiler messages, go to the View menu and select Logs. The messages will be under the Build Log and Build Messages tabs in the resulting window.

To get warnings about unused variables (and lots of other things), go to the Settings menu, choose Compiler & Debugger and then check Enable All Compiler Warnings in the Global Compiler Settings tab.

Offline Eureka

  • Single posting newcomer
  • *
  • Posts: 8
Re: Warnings and variables
« Reply #2 on: October 26, 2009, 11:27:53 am »
Thank you.
One thing: Logs was already selected, and as I said my warnings merely disappear once the program compiled. So what should I do ?

zabzonk

  • Guest
Re: Warnings and variables
« Reply #3 on: October 26, 2009, 11:50:44 am »
> my warnings merely disappear once the program compiled

Do you mean that the Log and Messages tabs are completely empty after a compilation or just that the warnings have disappeared? You should always have some messages in the Build Log and Messages tabs, if only to indicate succesful compilation.

I suppose now is also the time to ask which platform you are on and which version of CB you are using?


Offline Eureka

  • Single posting newcomer
  • *
  • Posts: 8
Re: Warnings and variables
« Reply #4 on: October 26, 2009, 12:05:45 pm »
I'm using C::B 8.02 and I'm on Ubuntu 9.04.
Actually there's something remaining after the compilation :

Quote
Checking for existence: /home/Eureka/Prog/Test/bin/Debug/Test
Executing: xterm -T Test -e /usr/bin/cb_console_runner /home/Eureka/Prog/Test/bin/Debug/Test  (in /home/Eureka/Prog/Test/.)
Process terminated with status 0 (0 minutes, 5 seconds)
« Last Edit: October 26, 2009, 12:08:15 pm by Eureka »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Warnings and variables
« Reply #5 on: October 26, 2009, 12:15:14 pm »
You most likely have clicked Build and run and not only build.

zabzonk

  • Guest
Re: Warnings and variables
« Reply #6 on: October 26, 2009, 12:18:53 pm »
OK, all is revealed - you are doing a build & run, which overwrites the compiler messages with the results of running your executable. You just need to do a Build only - select Build from the Build menu.

Offline Eureka

  • Single posting newcomer
  • *
  • Posts: 8
Re: Warnings and variables
« Reply #7 on: October 26, 2009, 12:23:32 pm »
Well, if I do a build only, here's what I get :

Quote
-------------- Build: Release in Test ---------------

Target is up to date.
Nothing to be done.


Still no warnings =(

zabzonk

  • Guest
Re: Warnings and variables
« Reply #8 on: October 26, 2009, 12:28:01 pm »
The warnings (unlike errors) will appear only the first time you successfully compile an executable. To see them again, to a Rebuild (also in the Build menu), or Compile CurrentFile, or make a minor change to the file(s) in question and do a normal Build.
« Last Edit: October 26, 2009, 12:31:46 pm by zabzonk »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Warnings and variables
« Reply #9 on: October 26, 2009, 12:30:16 pm »
The warnings will appear only the first time you successfully compile an executable. To see them again, to a Rebuild (also in the Build menu), or make a minor change to the file(s) in question.
Or clean the project, before build (does the same as rebuild, but you invoke the two steps manually).

Offline Eureka

  • Single posting newcomer
  • *
  • Posts: 8
Re: Warnings and variables
« Reply #10 on: October 26, 2009, 12:39:06 pm »
All right I get the warnings.
Thanks to both of you!