Why do I get the error "*Initialization* token-sequence in `#assert'" when I compile with gcc?

Updated: 04/18/01

This error is caused by the HP and GNU compilers using the -A command
line option for different things.

The HP compiler uses -A to set which dialect of C the compiler expects
to see in the input files, K&R (-Ac), ANSI (-Aa) or Extended ANSI (-Ae).
In recent versions, Extended ANSI mode is the default. In earlier
versions, K&R mode is the default.

The GNU compiler has a conditional compilation mechanism that allows
questions to be asked during the compilation using the construct '#if
#question(answer)' and a mechanism of telling the compiler in advance
the answers to questions with the construct '#assert question(answer)'.
For the GNU compiler the -A optoion is equivalent to a #assert
directive.

The error message above occurs when the GNU compiler gets the option -Aa
intended for the HP compiler and reads it as an attempt to provide the
answer to the question 'a' but the answer itself (which would appear in
brackets) is missing.

The problem can be resolved by removing the -Aa option from the command
line used for the compiler (check Makefiles for CC and CFLAGS settings)
as the GNU compiler defaults to understanding ANSI C anyway.



UNIXguide.net
Suggest a Site