LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   removing warnings (http://www.linuxquestions.org/questions/programming-9/removing-warnings-138922/)

h/w 01-26-2004 04:06 PM

removing warnings
 
hi, when we dont include the headers in C, and call printf() or exit(), we get the warning of an implicit declaration of those functions.
is there a way to not get these warnings, and not include the headers at the same time?

thanks.

Strike 01-26-2004 04:41 PM

Why wouldn't you include the headers explicitly? It gets done anyway.

acid_kewpie 01-26-2004 04:43 PM

you really shouldn't approach problems in this direction... you are clearly not using the language correctly, but you still want to fight it??

h/w 01-26-2004 04:43 PM

hmm .. yeah.
well, was just wondering.
thanks. :)

coolman0stress 01-26-2004 04:45 PM

what compiler are you using? I'm sure there is a way to supress warnings.

But like Strike mentioned, just include the headers.

h/w 01-26-2004 04:45 PM

gcc 3.
yeah, it's ok. was just wondering - that's all. :)

jim mcnamara 01-26-2004 06:06 PM

The answer is: extern int printf

But it isn't a good answer. If you ever read the /usr/include/nnn.h files you'll see why. There are all kinds of things that are declared different ways in different environments. eg., as macros vs functions or as float vs double.

All of this could become a problem for you running your code.


All times are GMT -5. The time now is 11:06 AM.