1

I've uninstalled and reinstalled mingw-64 and vscode, following the instructions at https://code.visualstudio.com/docs/cpp/config-mingw. I've set the include path and the compiler path. I look in the directory where all the header files are located, and, sure enough, iostream is in there.

This time I didn't get the squiggle line under #incluide the way I had before, when I typed in the helloworld program. Great! I thought, it's fixed. I compiled the program. The result?

helloworld.cpp:1:10: fatal error: iostream: No such file or directory
 #include <iostream>
          ^~~~~~~~~~
compilation terminated.
The terminal process terminated with exit code: 1

Here's the path: C:\MinGW_w64\mingw32\lib\gcc\i686-w64-mingw32\8.1.0\include\c++ Here's the compiler path: C:/MinGW_w64/mingw32/bin/g++.exe"

And, what the heck, here's the code:

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{

    vector<string> msg {"Hello", "C++", "World", "from", "VS Code!"};

    for (const string& word : msg)
    {
        cout << word << " ";
    }
    cout << endl;
}
Rob
  • 14,746
  • 28
  • 47
  • 65
lbrw
  • 11
  • 4
  • 1
    Perhaps you might want to consider switching to Linux, for C++ development, where every Linux distribution comes with the latest version of gcc, fully configured, and ready to use? It takes me about an hour to install Linux on a new system, which is probably less time than it would take to figure out why MS-Windows is borked. – Sam Varshavchik Nov 16 '19 at 16:12
  • @SamVarshavchik To be honest, you can easily get the latest GCC on Windows too, if you know where to look (MSYS2). :) – HolyBlackCat Nov 16 '19 at 16:16
  • @lbrw This doesn't have anything to do with VScode, right? Can you compile the code directly from the terminal? – HolyBlackCat Nov 16 '19 at 16:16
  • 2
    You've installed mingw64, so why is your include path under mingw32? – stark Nov 16 '19 at 16:17
  • Consider also this: https://stackoverflow.com/questions/4980819/what-are-the-gcc-default-include-directories – Bob__ Nov 16 '19 at 16:47

0 Answers0