Hi,
I need to write a simple function which will work only when a specific definition is defined, but i can't use ifdef in C file according to linux coding guidelines
so i wrote this example but i keep getting this error:
file.c: error: redefinition of 'function1'
file.h: error: previous definition of 'function1' was here
in this example all i want is that function1 will be called only if RUN_FUNC1 is defined, else i want the inline function1 to be called.
any ideas?Code:file.h ... #ifdef RUN_FUNC1 void function1(void); #else static inline void function1(void) { printk("RUN_FUNC1 not defined\n"); }; #endif ... file.c ... void function1(void) { printk("RUN_FUNC1 defined\n",); } ...
10x



LinkBack URL
About LinkBacks



