C++ in Xcode help

Discussion in 'Mac Programming' started by DeltaEKs, Feb 16, 2012.

  1. DeltaEKs macrumors newbie

    Feb 16, 2012
    I'm currently in college pursuing a degree in computer science. I'm trying to do all my homework in Xcode and so far it's worked out fairly well. However, I don't get why I'm getting a compiler error message when I type out the following into a class file:

    friend ostream & operator<< (ostream & output, const DateType & aDate);
    The error message is "Unknown type name 'ostream.'" I have tried including #include <fstream>, #include <iostream>, and #include <ifstream> (which seems to clear this error, but makes a new error saying "ifstream file can't be found")

    Any ideas on how to get this to work? I know Xcode has a few things that are incompatible with code taken from Windows compilers.

    And I guess while we're on the topic, is there anything I should know about programming for mac in general? I'm being taught in a Windows-oriented class setting and even though I can switch to my bootcamp side any time if I need to finish a project, I want to milk every ounce of usability out of Xcode as possible. (And besides, Xcode is so much easier to work with)
  2. lloyddean macrumors 6502a

    May 10, 2009
    Des Moines, WA
    Apparently you're not yet aware of namespaces!

    friend std::ostream & operator<< (std::ostream & output, const DateType & aDate);

Share This Page