2

I've installed msys/clang using pacman and run it (from the usr/bin bash terminal) on a simple file which only includes iostream:

$ clang++ main.cpp -o prog.exe main.cpp:1:10: fatal error: 'iostream' file not found #include <iostream> ^~~~~~~~~~ 1 error generated. 

When I compile with mingw64/clang using the MinG64 terminal, it works. When should the msys/clang be used in such a case, then, and is there a way of making it work?

mingw64/clang --version:

$ clang --version clang version 11.0.0 (https://github.com/msys2/MINGW-packages f5d4dab9b9db65e8b4eff740629c411ea5e21091) Target: x86_64-w64-windows-gnu Thread model: posix InstalledDir: C:\MSYS2\mingw64\bin 

usr/bin/clang --version:

$ clang --version clang version 11.0.0 (https://github.com/msys2/MSYS2-packages dab5c29f1c61a173e404f1fd78f0c6f56441aa9f) Target: x86_64-pc-windows-msys Thread model: posix InstalledDir: /usr/bin 
12
  • Does this answer your question? Msys2 and Clang on Windows: iostream file not found Commented May 6, 2021 at 14:30
  • @S.M. No, since I already have those installed. gcc has no problem compiling even if I run it from usr/bin, so I assume all the libraries and headers are there. Commented May 6, 2021 at 14:34
  • look at the environment variables defined by the MinG64 terminal, and compare with what's defined in the non-working Bash shell. Commented May 6, 2021 at 14:41
  • Try to Google "msys/clang fatal error: 'iostream' file not found" and follow other answers on Stackoverflow. As I got the main idea, mingw-w64-x86_64-gcc should be installed first. Commented May 6, 2021 at 14:41
  • 1
    @HolyBlackCat I've read you're not supposed to do that and don't really remember the reasoning, but frankly that solution seems to do exactly what I want. Thanks. Commented May 7, 2021 at 13:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.