Q:

Microsoft Visual Studio 17 errors compiling

Hello I have been having problems compiling and running my program.  I just recently switched over from code::block to microsoft visual 2017.  
The Error: Unable to start program 'c:\users\myname\documents\visual studio 2017\Projects\ConsoleApplication1\Debug\ConsolApplication1.exe' The system cannot find the file specified. 
#include <iostream>
#include <math.h>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include "stdafx.h"
using namespace std;

int main()
{
    cout << "hello";
    return 0;
}

The Consol:
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>ConsoleApplication1.cpp
1>c:\users\myname\documents\visual studio 2017\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(13): error C2065: 'cout': undeclared identifier
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED. 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

A:

For reasons I am not privy to, the compiler in Visual Studio ignores anything above the include of stdafx.h. 
Solution: Reorder the includes to place #include "stdafx.h" at the top. 
Alternate Solution: Remove #include "stdafx.h" and disable precompiled headers.  
The following may be helpful reading: Purpose of stdafx.h

