C++ compiler isn't being used
C++ compiler isn't being used
- Subject: C++ compiler isn't being used
- From: Steve Mills <email@hidden>
- Date: Wed, 24 Aug 2011 15:29:36 -0500
I'm on my way to learning Objective-C[++] and wondered why all the examples were using the archaic C rule of requiring the "struct" keyword before variable declarations:
struct car {
int year;
};
struct car myCar;
Having worked in C++ for the past umpteen years, I'm used to the compiler being smart enough to know better:
car myCar;
So in my Xcode project, I changed the Compile Source As setting to Objective-C++, thinking this would make things right. It didn't. The main.m file where I tested this still generated an error about an unknown type. I then changed the file name from main.m to main.mm and set the Compile Source As setting back to According to File Type. Now it compiled without error. Why did the first method not work? The project is set to use the LLVM 2.0 compiler, if that makes a difference.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden