Problems compiling - gcc Command line arguments

Erik Mouw J.A.K.Mouw@its.tudelft.nl
Thu Dec 30 07:10:00 GMT 1999


On Thu, 30 Dec 1999 13:58:52 +0000, Albert E. Whale wrote:
> I am currently involved in a Migration Project.  When I am compiling the
> source code, I am getting the following Warning statements which appear
> incocluous, but also prohibit the compilation process.

The warnings you describe are valid, IMHO. Without having access to your
source, I think your code looks more or less like:

  /* declaration */
  int src_alloc(void);

  ...

  /* implementation */
  static int src_alloc(void)
  {
    /* whatever */
  }

This is indeed an error: the function is declared global, but redefined as
static.

I'm just guessing, of course, can you show some example code? Can youalso
tell which gcc version you're using (use "gcc -v" to find out)?
  
> What is important to note here, is that there are no errors in the
> software whenever it is compiled on a Non-Linux box.  What command line
> options can I provide to the gcc compiler to reduce the number of
> warnings and get it to behave more like other compilers?

Gcc is actually quite good at pointing out potential bugs and/or language
violations; other C compilers are much more permissive. You can consider
this a bug in the non-gcc compilers, or a feature in gcc.

The flags you can try:
-w            Switch off all warnings. Quite dangerous.
-ansi         Only support ANSI C, no GNU C extensions.
-traditional  Attempt to support some aspects of traditional C compilers.

> fxscrf.c:247: warning: `scr_alloc' was declared implicitly `extern' and
> later `s
> tatic'
> fxscrf.c:123: warning: previous declaration of `scr_alloc'
> fxscrf.c:269: warning: `scr_free' was declared implicitly `extern' and
> later `st
> atic'
> fxscrf.c:221: warning: previous declaration of `scr_free'
> fxscrf.c:279: warning: `sub_alloc' was declared implicitly `extern' and
> later `s
> tatic'
> fxscrf.c:186: warning: previous declaration of `sub_alloc'
> fxscrf.c:336: warning: `sub_free' was declared implicitly `extern' and
> later `st
> atic'
> fxscrf.c:188: warning: previous declaration of `sub_free'
> fxscrf.c:371: warning: `setrownum' was declared implicitly `extern' and
> later `s
> tatic'
> fxscrf.c:262: warning: previous declaration of `setrownum'
> fxscrf.c:411: warning: `setslist' was declared implicitly `extern' and
> later `st
> atic'

Please show some example code which triggers this warning.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/





More information about the Gcc mailing list