Compiling C with Objective-C and duplicate symbol linker error (iPhone related) -


i have following file testf.h:

#ifndef testf_h_ #define testf_h_ int test(int what){     return what; } #endif 

i included/imported in testappdelegate.h (which used other .m files in xcode project). duplicate symbol error. if included/imported testf.h in .m file never included/imported in other files works fine. seems #ifndef/#define/#endif has no effect. there anyway go around this?

thanks

this function definition, belongs in c, cpp or m file.

this popular trick #defines protect compiler errors (typically survive circular #include dependencies. ) not protect against linker error. why people put declarations in h files , definitions in c (or m) files.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -