• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
C++ compiler isn't being used
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: C++ compiler isn't being used
      • From: Jens Alfke <email@hidden>
    • Re: C++ compiler isn't being used
      • From: Thomas Davie <email@hidden>
  • Prev by Date: Re: Does Xcode's Debug Console Handle/Print Malformed UTF-8 Correctly?
  • Next by Date: Re: C++ compiler isn't being used
  • Previous by thread: Problem when preprocessing Info.plist
  • Next by thread: Re: C++ compiler isn't being used
  • Index(es):
    • Date
    • Thread