Ramona Viktoria
Ramona Viktoria

Reputation: 1

c++ visual studio 2012 #include doesn't work

I just downloaded Visual Studio 2012 and tried my first programm with c++ but it doesn't work and I have no idea why. I hope someone can help me.

This is my code:

#include "stdafx.h"
#include <iostream>



int main(int argc, _TCHAR* argv[])
{
std::cout << "HelloWorld\n";
system("pause");

return 0;
}

When I tried to compile the programm, there is the following on the console:

1>  HelloWorld.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\climits(5): fatal error C1083: File (Include) could not be opened: "yvals.h": No such file or directory

Also when I put the mouse on "cout" it says: Error "namespace ""std"" has no member ""cout""

Has anybody an idea what is the problem and how I can fix this?

Upvotes: 0

Views: 1640

Answers (1)

fredoverflow
fredoverflow

Reputation: 263058

What kind of project have you created? For simple console applications, I strongly recommend "empty project". Then add a hello.cpp file to your project and paste following code:

#include <iostream>

int main()
{
    std::cout << "Hello world\n";
    std::cin.peek();
}

That should work, I've done it a dozen times. If it doesn't work, tell us the error messages.

Upvotes: 3

Related Questions