iostream: no such file or directory

17,540

You don't need to re-install Qt creator. If you want to use it for running C++ source code, you should first create a project file. Do as follows:

File -> New file or project -> Non-Qt project -> Plain C++ application;

So that you create a .pro file. Then Qt creator will be able to find library files <iostream> and the like. See https://stackoverflow.com/a/9613956/5383964 for a detailed explanation.

Share:
17,540
McLan
Author by

McLan

Updated on June 17, 2022

Comments

  • McLan
    McLan almost 2 years

    I am working with Qt creator on Windows vista. I am trying to compile a very simple ".cpp" code that includes the standard c++ library "iostream", like this:

    #include <iostream>
    using namespace std;
    int main(){
        cout << "thanks";
        return 0;
    }
    

    the problem comes even before compiling the code, it comes when Qt highlights the library and acknowledge me that (iostream: no such file or directory).

    It was working fine couple of days ago, then I installed VS-Express-2012 which I then uninstalled because, surprisingly, it does not work with windows Vista. immediately after the removal of VS-2012, c++ libraries are not seen by Qt creator any more .

    note that I can still compile and run my previous written codes by command-line console, which means c++ libraries haven't been removed with the removal of VS-2012!!. In addition, all my previous codes (within old projects which were created using the same Qt) has no such problem (i.e.: Qt identifies and sees the standard libraries), and I can still compile and run them normally using Qt creator, even when I create a new ".cpp" file within those old projects :

    enter image description here

    .. however, when I create a new ".cpp" file within a totally new project, libraries disappear and a link is missing:

    enter image description here

    .. (I don't want to get used to re-install Qt each time I have similar problem with the compiler, I would like to understand why this is happening in the first place)

    so, what exactly Qt is looking for (or where I should be looking at?), thanks