Project created as desktop folder Demo1(Desktop\c++\demo1\demo.cpp
Code:
#include <iostream>
using namespace std;
int main() {
cout << "Never fear, C++ is here!" << endl;
system("Pause");
return 0;
}
Compiler output from Build:
1>------ Build started: Project: demo1, Configuration: Debug Win32 ------
1>Object reference not set to an instance of an object.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Steps for setting up a project/solution in Visual Studio 2017:
https://www.learncpp.com/cpp-tutorial/writing-your-first-program/
One step that tutorial misses that I think is critical is creating an empty project. An empty project you add your source files manually without a lot of MS added code stuff.
I tried to duplicate your problem, alas could not.
You said that this is your path:
Project created as desktop folder Demo1(Desktop\c++\demo1\demo.cpp
I have the feeling that this is wrong.
But when I ran my VS and wanted to use the Desktop to put my solution I ended up with: C:\Users\andy\Desktop\Test project\Test project\Main V1.cpp
This part of the path C:\Users\andy\Desktop\ can be anything. Normally I use F:\VS 2017\ as the base path and what comes after that, the two subdirectories, is added by VS.
I am guessing that if the path, including the subdirectories, is not correct than VS is not finding the correct path and file.
Without knowing what you did to start with it is difficult to know where you went wrong. You may have to explain your steps when creating this program.