• 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
Mixing C++ and Obj-C (odd compile errors)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mixing C++ and Obj-C (odd compile errors)


  • Subject: Mixing C++ and Obj-C (odd compile errors)
  • From: Brad Peterson <email@hidden>
  • Date: Sun, 16 Sep 2007 03:52:24 -0700 (PDT)

Hi all,

I'm trying to include some C++ code in my
Cocoa/Foundation tool, and I'm getting a lot of
strange errors when compiling.

Specifically, a section like this:

  template<class T>
  WORD get_next_id(const std::map<WORD, T>& map_cont)
  {
    std::map<WORD, T>::const_iterator it =
map_cont.begin();

is generating quite a few errors.

(WORD is typedef'd as: typedef  UInt16 WORD;)

The errors are:

1. error: expected `;' before 'it'
2. error: dependent-name
'std::map<cab_header::WORD,T,std::less<cab_header::WORD>,std::allocator<std::pair<const
cab_header::WORD, T> > >::const_iterator' is parsed as
a non-type, but instantiation yields a type
3. note: say 'typename
std::map<cab_header::WORD,T,std::less<cab_header::WORD>,std::allocator<std::pair<const
cab_header::WORD, T> > >::const_iterator' if a type is
meant

It's been a really long time since I had to deal with
pure C++ and I confess these errors are far beyond my
ability to understand, let alone solve.

I'm hoping someone here has had to do something very
similar recently, and can offer me some insight. :)

Any thoughts or suggestions would be greatly
appreciated.

Many thanks,

B



____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mixing C++ and Obj-C (odd compile errors)
      • From: Scott Ribe <email@hidden>
    • Re: Mixing C++ and Obj-C (odd compile errors)
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: How to embed framework in app with setuid helper
  • Next by Date: Re: Singletons and Threads
  • Previous by thread: Re: IBPalette missing class information?
  • Next by thread: Re: Mixing C++ and Obj-C (odd compile errors)
  • Index(es):
    • Date
    • Thread