• 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
Re: Bug in the objective-c++ compiler?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in the objective-c++ compiler?


  • Subject: Re: Bug in the objective-c++ compiler?
  • From: Marc Parizeau <email@hidden>
  • Date: Wed, 15 Jun 2005 17:02:43 -0400


On 15-Jun-05, at 16:38, Scott Thompson wrote:


On Jun 15, 2005, at 3:20 PM, Marc Parizeau wrote:


Hi!

For the following simple C++ code (nothing else) and using Xcode 2.1 with gcc4:

namespace Toto {
    enum Protocol {eOther};
    Protocol getProtocol(void) {return eOther;}
}

Can anyone tell me why I'm getting the following error message with the objective-c++ compiler:

main.mm:3: error: 'Toto::Protocol' referred to as 'struct'
main.mm:2: error: 'Toto::Protocol' has a previous declaration here

It appears as if there is a predefined "struct Protocol" in objective-c, and that the objective-c++ compiler is confusing it with Toto::Protocol wich is an enum type.

If I replace the word "Protocol" by anything else, the error message disappears. Also, if I compile with gcc3.3 instead of gcc4, there is not problem.

Is "Protocol" a new reserved keyword in objective-c?

Many thanks in advance,


FWIW, if I copy your text into a new project and rename the file to "test.cpp" I don't receive a message from this code.

Of course, the code is valid in cpp. But copy it in a file called test.mm (or force the compiler to use objective-c++ mode) and you will get the error messages. If you look above (in my error messages), you will see that the error occured in a file called main.mm.


Cheers!


What is the file type extension on the File? If it's ".m" or ".c" then the system might be treating it as straight C. You would probably have to do something like"


typedef enum { eOther } Protocol;

Scott



-- Marc Parizeau Laboratoire de vision et systèmes numériques (LVSN) Département de génie électrique et de génie informatique Université Laval, Québec (QC), Canada, G1K 7P4 tél: (418) 656-2131, ext. 7912 fax: (418) 656-3159


_______________________________________________ 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: Bug in the objective-c++ compiler?
      • From: Scott Thompson <email@hidden>
References: 
 >Bug in the objective-c++ compiler? (From: Marc Parizeau <email@hidden>)
 >Re: Bug in the objective-c++ compiler? (From: Scott Thompson <email@hidden>)

  • Prev by Date: Re: Xcode Project File Format
  • Next by Date: Re: Bug in the objective-c++ compiler?
  • Previous by thread: Re: Bug in the objective-c++ compiler?
  • Next by thread: Re: Bug in the objective-c++ compiler?
  • Index(es):
    • Date
    • Thread