getting hello world program to compile

Hi adtyerheryh!
I made a new blank project (er... "solution") and created this source file in it:

#include <stdio>
int main () {
 cout << "Hello World";
 return 0;
}

When compiling it I got an error message saying stdafx.h was missing. When I included it I got a different error message. What am I missing
Disable "Precompiled headers" in the project settings!
"Project|Settings|C++|Precompiled headers": None (or off).
-- 
Greetings
 Jochen
 
  My blog about Win32 and .NET
  http://blog.kalmbachnet.de/


Answer this question

getting hello world program to compile

  • Steven Yetter

    I made a new blank project (er... "solution") and created this source file in it:

    #include <stdio>
    int main () {
     cout << "Hello World";
     return 0;
    }

    When compiling it I got an error message saying stdafx.h was missing. When I included it I got a different error message. What am I missing

  • jaortizgonzalez

    wrote in message news:2c5ec770-d581-416b-9400-82a36f071b81@discussions.microsoft.com > I made a new blank project (er... "solution") and created this source > file in it: > > #include > int main () { > cout << "Hello World"; > return 0; > } Be aware that there is no header named stdio - there's one named stdio.h. Further, cout is defined in iostream header, not in stdio.h. Further still, all STL symbols including cout are in namespace std. Putting it together, your program should read #include int main () { std::cout << "Hello World"; return 0; } -- With best wishes, Igor Tandetnik
  • getting hello world program to compile