5

I followed this tutorial (here) to get Clang working on windows. I choose the path to install clang in combination with msys2.

After following all instructions I wrote the simple programme:

#include <iostream> using namespace std; int main() { cout<<"Hello, World!\n"; return 0; } 

After compiling with: clang++ Helloworld.cpp -o Helloworld.exe -std=c++14

I get the error:

*Helloworld.cpp:2:10: fatal error: 'iostream' file not found,

1 error generated.*

Adding -v in the command line I get:

Errors

clang version 3.9.1 (tags/RELEASE_391/final) Target: x86_64-w64-windows-gnu Thread model: posix InstalledDir: C:\msys64\mingw64\bin "C:\\msys64\\mingw64\\bin\\clang++.exe" -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -disable- llvm-verifier -discard-value-names -main-file-name Helloworld.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\msys64\\mingw64\\bin\\..\\lib\\clang\\3.9.1" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\x86_64-w64-mingw32" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\backward" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\\\x86_64-w64-mingw32" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include\\c++\\\\backward" -internal-isystem "C:\\msys64\\mingw64\\include\\c++\\" -internal-isystem "C:\\msys64\\mingw64\\include\\c++\\\\x86_64-w64-mingw32" -internal-isystem "C:\\msys64\\mingw64\\include\\c++\\\\backward" -internal-isystem "include\\c++" -internal-isystem "include\\c++\\x86_64-w64-mingw32" -internal-isystem "include\\c++\\backward" -internal-isystem "C:\\msys64\\mingw64\\bin\\..\\lib\\clang\\3.9.1\\include" -internal-isystem "C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include" -internal-isystem "C:\\msys64\\mingw64\\include" -std=c++14 -fdeprecated-macro -fdebug-compilation-dir "C:\\msys64\\programming" -ferror-limit 19 -fmessage-length 0 -femulated-tls -fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o "C:\\msys64\\tmp\\Helloworld-2393e7.o" -x c++ Helloworld.cpp clang -cc1 version 3.9.1 based upon LLVM 3.9.1 default target x86_64-w64-windows-gnu ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++\x86_64-w64-mingw32" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++\backward" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++\" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++\\x86_64-w64-mingw32" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include\c++\\backward" ignoring nonexistent directory "C:\msys64\mingw64\include\c++\" ignoring nonexistent directory "C:\msys64\mingw64\include\c++\\x86_64-w64-mingw32" ignoring nonexistent directory "C:\msys64\mingw64\include\c++\\backward" ignoring nonexistent directory "include\c++" ignoring nonexistent directory "include\c++\x86_64-w64-mingw32" ignoring nonexistent directory "include\c++\backward" ignoring nonexistent directory "C:\msys64\mingw64\x86_64-w64-mingw32\include" #include "..." search starts here: #include <...> search starts here: C:\msys64\mingw64\bin\..\lib\clang\3.9.1\include C:\msys64\mingw64\include End of search list. Helloworld.cpp:2:10: fatal error: 'iostream' file not found #include <iostream> ^ 1 error generated. 

How do I get the system to find iostream? I read something about,that you have to point to the mingw headers in clang/lib/Frontend/InitHeaderSearch.cpp. I couldn't find the file InitHeaderSearch.cpp on my computer.

Thank you for your help.

Windows 8 Clang 3.9.1

0

1 Answer 1

2

Due to mistake in the build script some dependencies are missing.

Installing gcc package (mingw-w64-i686-gcc for 32 bit and mingw-w64-x86_64-gcc for 64 bit) will pull them.

Sign up to request clarification or add additional context in comments.

2 Comments

This does not solve the issue for me
With /usr/bin/clang, the issue persists. Perhaps installing these packages resolves the issue for /mingw32/bin/clang and /mingw64/bin/clang?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.