We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

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

Medium Priority
294 Views
Last Modified: 2013-12-14
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

screener.png
Comment
Watch Question

Author

Commented:
anyone?
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.