Hello!! I have started learning c++ and it has been a real sucess until now. My codes that worked before and those that im trying to use now, doesn't work.. I get a compiler error... Here is the code and the error: // tutorialearning.cpp : Defines the entry point for the console application.
#include <iostream>
#include <stdafx.h>
int doubleNumber(int x)
{
return 2 * x;
}
int main()
{
using namespace std;
cout << "Number to double: " << endl;
cin >> x;
cout << "Doubled number: " << doublenumber(x) << endl;
return 0;
}
And im getting this in the compiler when i try to build:
1>------ Build started: Project: tutorialearning, Configuration: Debug Win32 ------
1>Compiling...
1>tutorialearning.cpp
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(4) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(14) : error C2871: 'std' : a namespace with this name does not exist
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(15) : error C2065: 'cout' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(15) : error C2065: 'endl' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(16) : error C2065: 'cin' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(16) : error C2065: 'x' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(17) : error C2065: 'cout' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(17) : error C2065: 'x' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(17) : error C2065: 'endl' : undeclared identifier
1>d:\c++projects\tutorialearning\tutorialearning\tutorialearning.cpp(17) : error C3861: 'doublenumber': identifier not found
1>Build log was saved at "file://d:\c++projects\tutorialearning\tutorialearning\Debug\BuildLog.htm"
1>tutorialearning - 9 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I really appreciate if you help me and such, thank you!!