#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{

cout << "Hello World!";
cin.get();
return 0;


}

Compiles and runs in dev cpp and notepad ++ but not in visual, Im trying to teach myself witht he internet but have no idea why this wont work.

1>------ Build started: Project: Hello world.cpp, Configuration: Debug Win32 ------
1>  Hello world.cpp.cpp
1>c:\users\david\documents\visual studio 2010\projects\hello world.cpp\hello world.cpp\hello world.cpp.cpp(9): error C2065: 'cout' : undeclared identifier
1>c:\users\david\documents\visual studio 2010\projects\hello world.cpp\hello world.cpp\hello world.cpp.cpp(10): error C2065: 'cin' : undeclared identifier
1>c:\users\david\documents\visual studio 2010\projects\hello world.cpp\hello world.cpp\hello world.cpp.cpp(10): error C2228: left of '.get' must have class/struct/union
1>          type is ''unknown-type''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What type of project did you select? Make a new project with Win32 Console as the type.

Don't select empty project, and you can uncheck Precompiled Headers.

Ah, thats exactly it. I used an empty project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.