This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static declaration of foo follows non-static declaration


In that case, have you made sure that foo is declared before it is used ?

And can you attach some code snippe.

-Aseem.

Dhiraj.Nilange@iflexsolutions.com wrote:

Hi Aseem,

This is a pure 'C' code. So it doesn't have any class. Here foo is one
global function.

Basically this is a typical C file where many functions are defined (foo is used by some other functions in the same C file). Being
outside any scope they are global. There is no main function defined.



Thanks, -Dhiraj

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Aseem Rastogi
Sent: Monday, June 11, 2007 4:49 PM
To: Dhiraj Nilange-DD
Cc: gcc-help@gcc.gnu.org
Subject: Re: static declaration of foo follows non-static declaration

I doubt the way you are using foo () in your code. I hope you are aware that static functions should be used by prefixing them with class name. For ex. if class name is A and function is foo, you should write A::foo
().


If you can show some code, it would be better.

-Aseem.

Dhiraj.Nilange@iflexsolutions.com wrote:

Hi,

During gcc compilation of  C code I am getting these strange errors
(compile time):-


error: static declaration of foo follows non-static declaration


error: previous implicit declaration of foo was here


foo is some function here. These errors are surprising, because there


is

only one definition of the function foo. Moreover this code perflectly
gets compiled using IBM's xlr_c and HP's aCC. So I guess this is gcc
specific issue. Please help!

Thanks,
-Dhiraj










Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]