XCode C++ Question....

Discussion in 'Mac Apps and Mac App Store' started by Weasler, Jul 25, 2007.

  1. Weasler macrumors newbie

    Jul 25, 2007
    After programming on Windows for a while, I decided to come over to Mac and see port some of my work. But as it seems, for some reason XCode will not allow me to preform a simple task of making a Hello World application in Command Line C++. Here is a quick example (very very quick) of the language I know, and for some reason, it is not working, even though it works in Blodshed.

    #include <iostream>
    #include <stdlib.h>

    int main(int argc, char *argv[])
    cout << "Hello World" << end1;
    return 0;

    Any advice?
  2. After G macrumors 68000

    After G

    Aug 27, 2003
    shouldn't that "1" be an "L"?

    and i'd declare a namespace if I were you.

    oh yea, you don't need the standard library either.

    #include <iostream>
    using namespace std;
    int main(int argc, char *argv[])
    cout << "Hello World" << endl;
    return 0;
  3. dcr macrumors member

    Jun 10, 2002
    in standards-compliant C++, iostream and therefore cout and endl are part of the std namespace.

    so you want


    instead of the global

    also, i think you mean to be using std::endl and not std::end1

    and generally speaking, avoid std::endl unless you need to explicitly flush the iostream immedately. you're often better off using the standard newline \n


Share This Page