Error when compiling C++ program on Visual Studio Community 2015

Hi guys,

I'm learning C++ and I would like to ask about error which I've gotten when running Visual Studio 2015.

I just write a simple Hello World code and get error not initialize object. I have image of error here.

http://i.imgur.com/SEvYnAa.png

Here is my code:

1
2
3
4
5
6
7
8
9
10
11
#include "stdafx.h"
#include "iostream"


using namespace std;

int main()
{
	cout << "Hello World" << endl;
    return 0;
}



Thank you very much.
Last edited on
closed account (E0p9LyTq)
#include "iostream" should be #include <iostream>
closed account (E0p9LyTq)
What template did you use when you created your project? You should select the Visual C++/Windows/Win32/Win32 Console Application template. From the look of your multiple errors I doubt you chose that template.
You could try using 'Empty Project' template.
Have you used older IDE compliers before?
closed account (E0p9LyTq)
AcarX wrote:
You could try using 'Empty Project' template.

A very good suggestion, but for a beginner that could cause problems. Using the "Empty Project" template doesn't set project/solution settings needed for a Win32 app. Whether it is a console/Windows app, DLL or static library.

For a beginner it could be better with VS 2015 to use the "Win32 Console Application" template and simply select the "Empty project" in the "Win32 Application Wizard" at the "Applications Settings" screen (2nd screen). No "precompiled headers/stdafx.h" garbage to deal with. Just add/create the source files as needed for the project.

Using the "Empty project" setting from the wizard makes it easier to switch app configuration (debug/release) and platform (x86/x64) without having to worry about changing project settings, VS 2015 does it for you. Changing project settings can be very intimidating for a beginner.
Last edited on
Your image of errors isn't really relative to your problems :), you should use "library" for the library what was created by yoursefl, and <library> for template library
Topic archived. No new replies allowed.