• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

new to Visual Studio and c++ and cant run my first program

new to Visual Studio and c++ and cant run my first program
when compile program below I get error as per the screeshot

#include <iostream.h>
int main() {
	cout << "Hello World!!! \n";
	return 0;

Open in new window

1 Solution
jtiernan2008Author Commented:
You are missing std:: in front of cout i.e. it should be:

std::cout << "Hello World!!! \n";

or add:

using namespace std;

right after #include <iostream>

This is however not the cause for this particular error, it seems that something is wrong with the project settings and looking on the right side of the image there is no Source file listed there, I would recommend creating a new project:

1) File -> New -> Project
2) Make sure you select "Win32 Console Application"
3) On the wizard ensure "Console application" is selected
4) Check "Empty project"
5) Right-click on the "Source Files" folder on the right-side
6) Select "Add" then "New Item"
7) Select "C++ File (.cpp)"
8) Enter a name, e.g. "main"
9) Add your code and run the application
#include <iostream>
int main() 
	std::cout << "Hello World!!! \n";
	return 0;

Open in new window


Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now