So i'm trying to run this in Visual Studio but it gives me several errors in the output console:
1>------ Build started: Project: ConsoleApplication1, Configuration: Release x64 ------
1> stdafx.cpp
1> ConsoleApplication1.cpp
1>ConsoleApplication1.cpp(6): error C2039: 'cout': is not a member of 'std'
1> predefined C++ types (compiler internal)(209): note: see declaration of 'std'
1>ConsoleApplication1.cpp(6): error C2065: 'cout': undeclared identifier
1>ConsoleApplication1.cpp(6): warning C4554: '<<': check operator precedence for possible error; use parentheses to clarify precedence
1>ConsoleApplication1.cpp(6): error C2039: 'endl': is not a member of 'std'
1> predefined C++ types (compiler internal)(209): note: see declaration of 'std'
1>ConsoleApplication1.cpp(6): error C2065: 'endl': undeclared identifier
My code is as follows:
#include <iostream>
#include "stdafx.h"
void test(int x, int y)
{
std::cout << x + y << std::endl;
}
int main()
{
test(1, 2);
return 0;
}