C preprocessor directive error -



C preprocessor directive error -

i have problem when want utilize scripts:

lib1.h ... #ifdef lib1_01 int lib1func(void); #endif ... lib1.c ... #ifdef lib1_01 int lib1func(void){ ... } #endif ... main.c #define lib1_01 #include <lib1.h> int main(){ ... int x = lib1func(void); ... ...

i want utilize lib1func() when #define lib1_01 declared have 'warning : implicit declaration of function' error when utilize it...why ? can help me ? best regards.

recommended alternative:

lib1.h

#ifndef lib1_h #define lib1_h int lib1func(void); #endif ...

lib1.c

#include "lib1.h" int lib1func(void){ ... }

main.c

#include "lib1.h" int main(){ ... int x = lib1func(void); ... ...

note:

1) should declare "int lib1func(void)" in header, may define anywhere. in lib1.c (if prefer), or main.c. create sure define once.

2) note utilize of guard around entire header body.

3) note utilize of include "myheader.h" (for own header files), vs. #include <systemheader.h>. "<>" syntax should used scheme headers.

c c-preprocessor

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -