-1

I tried to test something really simple in VS 2012, like printing a message using C++, but it wouldn't compile.

It tells me that the iostream file cannot be opened!!!

The error message is "cannot open source file "iostream""

The code is as follows

#include <iostream>
using namespace std;
int main ()
{
    cout << "any thing!!" << endl ;
    return 0;
}

I checked in my hard drive, and i found the file, but it looks like that the VS 2012 can't read it or doesn't see it at all.

It also wouldn't let me compile any old projects that I've done.

Falko
  • 17,076
  • 13
  • 60
  • 105
Boda
  • 329
  • 2
  • 11

1 Answers1

1

I had that problem too, I needed to paste in all the libraries and librarypaths to the vs-2012-internals.

Under vs-2012:

1) go to: Project -> "My_Project"-Properties

2) Here opens a window, go to: Configurationsettings -> VC++-Paths (I have the german version, so I am sorry if those names are a bit different to those in your version of vs-2012)

3) make sure Includedirectories and Librarydirectories are linked well.

4) now go back to "Configurationsettings" -> Linkers -> Input and make sure all the needed additional dependancies are in the list.

I hope that helped :) for me, that worked.

Edit: I don't actually know if this affects your problem, but as off vs-2012 I needed to paste winmm.lib to the additional dependancies, if I don't do this, nothing works.

Chaos
  • 374
  • 2
  • 11
  • what do u mean by "linked well" in number 3 ?? – Boda Jun 18 '13 at 17:43
  • one more thing, now i have to change it within every project!! is there a way i can change once for all existed projects and the now one too ??? – Boda Jun 18 '13 at 18:26
  • you can make a applicationshell, meaning you program the needed stuff like an empty main method, include some things and link everything right, then save it and just make a copy of all this. you only need to make sure that the additional includefiles (e.g. you have some local engine or stuff) have new paths then and need to be relinked. thats how you can try it, I for my part link everything completely new when I start new projects. but i dont do that often, maybe twice a year. because i program games and they are not ready as fast as a normal application is. I hope that helps a bit :) – Chaos Jun 18 '13 at 22:11