[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI with gcc 4.6.0

From: Fred Kiefer
Subject: Re: GUI with gcc 4.6.0
Date: Mon, 23 May 2011 13:32:47 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv: Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10

On 23.05.2011 01:10, Germán Arias wrote:
On lun, 2011-05-23 at 00:13 +0200, Fred Kiefer wrote:
On 22.05.2011 01:50, Germán Arias wrote:
Compiling GUI with gcc 4.6.0 I get the error:

Making all for tool say...
   Compiling file say.m ...
say.m: In function 'main':
say.m:17:12: error: defines the variable 'outfile' but not used
all warnings are treated as errors

make[5]: *** [obj/say.obj/say.m.o] Error 1
make[4]: *** [internal-tool-all_] Error 2
make[3]: *** [say.all.tool.variables] Error 2
make[2]: *** [internal-all] Error 2
make[1]: *** [internal-all] Error 2
make: *** [internal-all] Error 2

There are to angles to this problem. One is of course that, as gcc
reports, we have an unused variable in our code, which we should safely
remove. The other is that gcc treats warnings as errors and fails
because of this. I don't think that this is the standard even for gcc
4.6. You should find out where this is set and remove that setting.

Well, the variable "outfile" is declared as

        NSString *outFile = nil;

and is used inside the loop while. But for some reason (I don't know how
the compiler works) show the previous error. Of course, I can compile
GUI removing the option -Werror in GNUmakefile of tool "say".  And I
don't know if this option is really necessary here (I think no).

This option is never necessary, it just forces a developer to clean up her code. Still that option should never make it into release make files as different compilers may be a bit more strict and then perfect valid code will no longer compile. Has happened in your case.

The compiler obviously was correct, as outFile was set at two places but never read and this was what the compiler reported.

I changed the code to actually use that variable, corrected the indentation and got the code to compile with non-C99 compilers. And then I commented out that compiler option. Just to make sure :-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]