Where is your include guard?

#ifndef MYPCH_H_INCLUDED
#define MYPCH_H_INCLUDED

/* current content */

#endif /* MYPCH_H_INCLUDED */

You should use it even if you're used to or expect #import to be used.

On Thu Jan 02 2014 at 10:19:18 PM, Kevin Mitchell <[email protected]>
wrote:

> Wait, I understand what's happening. It's obeying the "-include mypch.h"
> flag when it compiles mypch.h. In that case, how do I get similar behaviour
> to Xcode which automatically includes the headers to the beginning of every
> .m file?
>
>
> On Thu, Jan 2, 2014 at 11:48 AM, Kevin Mitchell <[email protected]>wrote:
>
> I am trying to use the precompiled header functionality of GNUstep-make.
> It seems to work well except that it chokes if I have static inline
> functions in the header I'm precompiling. I use the
> XXX_OBJC_PRECOMPILED_HEADERS variable and specify "-include mypch.h" in
> ADDITIONAL_OBJCFLAGS (the header doesn't seem to get included if i don't
> since its not referenced in the .m file).
>
> The problem is that when I try to compile, I get errors (below). What am I
> doing wrong?
>
>
> $ make
> This is gnustep-make 2.6.2. ....
> Making all for tool mytool...
>  Precompiling header file mypch.h ...
> mypch.h:1:20: error: redefinition of ‘myfunc’
>  static inline void myfunc()
>                     ^
> In file included from <command-line>:0:0:
> ./mypch.h:1:20: note: previous definition of ‘myfunc’ was here
>  static inline void myfunc()
>                     ^
> make[2]: *** [obj/mytool.obj/PrecompiledHeaders/ObjC/mypch.h.gch] Error 1
> make[1]: *** ["mytool".all.tool.variables] Error 2
> make: *** [internal-all] Error 2
>
>
> GNUMakefile:
> #####################################################
> include $(GNUSTEP_MAKEFILES)/common.make
> TOOL_NAME = "mytool"
> mytool_OBJC_FILES = mytool.m
> mytool_OBJC_PRECOMPILED_HEADERS = mypch.h
>
> ADDITIONAL_OBJCFLAGS += -Wextra -include mypch.h
>
> include $(GNUSTEP_MAKEFILES)/tool.make
> #####################################################
>
> mypch.h
> #####################
> static inline void myfunc()
> {
>   return;
> }
> #####################
>
> mytool.m
> #############################
> int main(int argc, const char * argv[])
> {
>   return 0;
> }
> #############################
>
>
>
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to