Implicit Function Declaration

07 Oct 2012

I'm compiling existing .c (not .cpp) program that works on other platforms. Compiler warns of many 'Implicit Function Declaration' then gives up without generating code (0 errors, 40 warnings. Other compilers (ex: GCC) aren't bothered by the warnings. Wonder why no code generated and if a simple way around this?

18 Oct 2012

Hi,

Tom Cantrell wrote:

Compiler warns of many 'Implicit Function Declaration' then gives up without generating code (0 errors, 40 warnings.

Normally, compiler generate object file if you have no error even you got a lot warnings. You probably got linker errors for resolving symbol references. I suggest to check your function prototypes (declarations) are in your header files (or part of your source file).

If you want to force suppress these warnings, you can put following pragma in your top of source file. But, I don't think it is a good idea.

#pragma diag_suppress 223

Regards, Toyomasa Watarai

04 Nov 2012

I would advise against using the pragma, rather I would suggest that it is best to work on your code until there are no warnings.

Toyomasa is correct in all he says, it is just not wise for a novice to act as the Master does.

The warnings you are seeing are the compiler telling you that you have just done something naughty in bringing a stranger to the party. Any decent compiler expects to be told who will be at the party, such introductions are called 'prototypes'. You list them at the begining of your program so that the compiler knows how to 'shake hands' with them. If you do not introduce them the compiler will make assumptions which may or may not be right ... and if you use the pragma you will never know, you might well just end up having an application that mysteriously fails.

Lazy programmers on large projects ignore warnings .. good programmers are polite :-)