.CPP files using the SIO2.h include?

View previous topic View next topic Go down

.CPP files using the SIO2.h include?

Post  Cobbler on Wed Feb 04, 2009 9:33 am

Probably a silly question but this is all new to me Smile

I added a new .CPP file to my project and included "sio2.h" in that .CPP file but it will not compile. It compiles after renaming the file to .MM. My question is, must any source file using the SIO2 Engine use the .MM extension?

Cobbler

Posts : 15
Join date : 2009-02-01

View user profile

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  monsterkodi on Wed Feb 04, 2009 9:55 am

The question isn't stupid at all. I had to learn this stuff myself when I started using sio2:

Sio2 mixes objective c and c++ code, also known as "objective c++".
If the suffix of a file is .mm Xcode sets the file type automatically to sourcecode.cpp.objcpp.
But if you want to keep the suffix .cpp, you can tell Xcode manually to treat the file as an objective c++ source in the inspector.
That's how it's done for all the sio2 sources in the template projects for example.

I hope that answers your question.
avatar
monsterkodi

Posts : 21
Join date : 2009-01-15

View user profile http://monsterkodi.net

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  Cobbler on Wed Feb 04, 2009 11:31 am

That makes sense but how do I tell XCode that .cpp should be treated as objective c++ files? I'm looking at Filer Types in XCode Preferences where I find

Code:
sourcecode
 sourcecode.c
  sourcecode.cpp
  sourcecode.cpp.h
  sourcecode.cpp.objcpp
  sourcecode.cpp.cpp

and all of them are set to Default (Source Code File). Am I looking in the wrong place?

Cobbler

Posts : 15
Join date : 2009-02-01

View user profile

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  zzajin on Wed Feb 04, 2009 2:37 pm

There might be a better way of doing this, but you can right click any file in XCode and "Get Info". It will open a dialog and on the "General" tab you will find a "File Type" pulldown menu. Select "sourcecode.cpp.objcpp".

With this method you can individually change "file types" of the files in XCode.

zzajin

Posts : 81
Join date : 2008-10-14

View user profile

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  Cobbler on Wed Feb 04, 2009 5:32 pm

Thanks! That works but it is tedious so a better solution is welcome if anyone has one...

Cobbler

Posts : 15
Join date : 2009-02-01

View user profile

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  zzajin on Wed Feb 04, 2009 8:42 pm

I should have thought about this before, but you can select multiple files thus setting the file types of them all at once.

zzajin

Posts : 81
Join date : 2008-10-14

View user profile

Back to top Go down

Re: .CPP files using the SIO2.h include?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum