c - warning: implicit declaration of function - order of includes matter? -
i have following sample code snippet of code main.c calls 3 functions, 3 headers - giving me warnings reason unknown:
#include "header1.h" #include "header2.h" #include "header3.h" int main() { function1(); // header1 function2(); // header2 function3(); // header 3 }
basically, after using gcc, functions 2 & 3 produce warning. however, after rearranging code this:
#include "header3.h" #include "header1.h" #include "header2.h" int main() { function1(); // header1 function2(); // header2 function3(); // header 3 }
it give me warning functions 1 & 2 implicit. doing wrong here?
your include file 1 should this:
#ifndef __rezon_functions1__ #define __rezon_functions1__ #endif
the other 2 files should similar macro name changed accordingly
Comments
Post a Comment