Re: More fun with C++

2008-04-03 Thread Herb Petschauer
Ah, we can easily go to the loony bin with this one. You have to start doing: typedef struct Foo { Byte a; } Foo; #ifdef __cplusplus class Bar { private: Foo mFoo; }; #endif or just refactor your code and (in this case) add a ProjectTypes.h which contains common structures and types (common

Re: More fun with C++

2008-04-03 Thread Scott Ribe
> #ifdef __cplusplus > > C++ stuff > > #endif As long as you don't need to reference the C++ stuff from a .m file. But then, should the header even be included by any .m files? Sure, there are times when C++ and non-C++ stuff might belong together in a header, but most of the time my C++ headers

Re: More fun with C++

2008-04-03 Thread Herb Petschauer
There are some hits to using .mm rather than .m files (check the list archives). Nothing major enough to sound any dire warnings though ;-) And sometimes you are adding C++ to an existing Obj-C only project (and I hate renaming every .m file to a .mm file in version control plus the potential los

Re: More fun with C++

2008-04-03 Thread Jean-Daniel Dupas
No but you include it in a Obj-C++ source file. Rename your obj-c file with a .mm extension. Le 3 avr. 08 à 18:23, Jens Alfke a écrit : On 3 Apr '08, at 9:05 AM, Herb Petschauer wrote: # ifdef __cplusplus extern "C" { # endif That won't help if the header is using C++-only syntax like

Re: More fun with C++

2008-04-03 Thread Herb Petschauer
You know I actually gave the wrong example there :-) It's not the extern "C" it is just the #ifdef __cplusplus C++ stuff #endif I do this all the time (honest). This will compile when included from a ".m" file because _cplusplus won't be defined. Hopefully I've got it right this time (post

Re: More fun with C++

2008-04-03 Thread Jens Alfke
On 3 Apr '08, at 9:05 AM, Herb Petschauer wrote: # ifdef __cplusplus extern "C" { # endif That won't help if the header is using C++-only syntax like namespaces and classes. You just can't #include that stuff from a C or Obj-C source file. —Jens smime.p7s Description: S/MIME cryptogr

Re: More fun with C++

2008-04-03 Thread Herb Petschauer
# ifdef __cplusplus extern "C" { # endif C++ stuff # ifdef __cplusplus } # endif It's in the Cocoa Dev archives (probably a subject search containing "C++"). Cheers, -H. On 03/04/2008, Paul Thomas <[EMAIL PROTECTED]> wrote: > > On 3 Apr 2008, at 13:48, Brad Peterson wrote: > > > > Hi, > >

Re: More fun with C++

2008-04-03 Thread Paul Thomas
On 3 Apr 2008, at 13:48, Brad Peterson wrote: Hi, Seems like I'm once again behind the "mixing Obj-C with C++" 8-ball. :( This time, I'm getting compile errors in the .h file of my C++ class. Specifically, just this much code: using namespace std; class CXLSWriter { Generates 3 errors,

More fun with C++

2008-04-03 Thread Brad Peterson
Hi, Seems like I'm once again behind the "mixing Obj-C with C++" 8-ball. :( This time, I'm getting compile errors in the .h file of my C++ class. Specifically, just this much code: using namespace std; class CXLSWriter { Generates 3 errors, and one warning: error: syntax error befor