[SDL] Scrap for OSX (copy and paste)
E. Wing
ewmailing at gmail.com
Wed Dec 5 14:43:28 PST 2007
So a #include in a file is equivalent to copying the entire contents
of the file you are including and pasting it in the calling file.
So if you #include a .m file from a .c file, you've effectively just
changed your pure C file to Obj-C. (Same goes for C++.)
This is probably why you are getting errors. You are compiling
Objective-C code as C instead of Obj-C.
As I said, my recommendation is that your main.c should only #include
the public header file (scrap.h) which is a pure C interface. Then
compile scrap.c or scrap_OSX.m depending on the platform.
-Eric
On 12/5/07, Josiah <ravean_uo at hotmail.com> wrote:
> E. Wing <ewmailing <at> gmail.com> writes:
>
> > I think this is more trouble than dealing with the separate files. So
> > I personally recommend you leave it as is, and structure your build
> > system to have a case that says, 'when on Mac, compile scrap_OSX.m,
> > otherwise compile scrap.c'.
>
> Do you know if there is anyway to tell XCode this from inside main.c? If it
> was
> a .c file I would just have a #include inside a #ifdef OSX but including the
> .m
> file gives a whole bunch of errors.
>
> Josiah
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
More information about the SDL
mailing list