• 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: Compiler error when handling C++ std::string class variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler error when handling C++ std::string class variable


  • Subject: Re: Compiler error when handling C++ std::string class variable
  • From: Steve Checkoway <email@hidden>
  • Date: Thu, 12 Jun 2008 16:04:43 -0700


On Jun 12, 2008, at 8:01 AM, David Lobron wrote:

I added an explicit include statement (#include <string>). Now, I get this error:

Time.h:26:18: error: string: No such file or directory

This makes me think it's compiling as C, not C++.

I get this in the pre-compiling headers stage - there are lots of others, also for ::namespaces that are missing. It's coming from a file that is part of the SDK.

This is probably trying to produce a C precompiled header. You should paste the compile line into emails asking about compiler errors.


If you want to have a shared C and C++ header, you need to wrap the C+ + stuff with the appropriate guard:
#ifdef __cplusplus
// C++ stuff
#endif


On Jun 11, 2008, at 12:55 PM, David Lobron wrote:

This compiles without a problem on Linux - only XCode throws the error. I suspect it might be happening because I'm not supplying a link command, e.g., to a libstdc++ dynamic library. However, I'm not sure what library to link with, or if library paths are even the problem. If anyone has seen this kind of error before, please let me know! I've never had a project with C++ in it, only Objective-C, so I'm a newbie here.

You're probably not trying to build a precompiled header on Linux.

--
Steve Checkoway

    "Anyone who says that the solution is to educate the users
    hasn't ever met an actual user." -- Bruce Schneier




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Compiler error when handling C++ std::string class variable (From: David Lobron <email@hidden>)
 >Re: Compiler error when handling C++ std::string class variable (From: Dave Carrigan <email@hidden>)
 >Re: Compiler error when handling C++ std::string class variable (From: David Lobron <email@hidden>)

  • Prev by Date: Re: Crash in virtual method call
  • Next by Date: Re: How do I create a nib? ...
  • Previous by thread: Re: How do I create a nib? ...
  • Next by thread: Error on compile
  • Index(es):
    • Date
    • Thread