c++11 - Clang on WIndows finds VC headers instead of GCC -
when had clang 3.7 installed find stl headers gcc installation long both 2 directories in path.
now have installed clang 3.8 compiler keeps finding visual studio headers despite fact isn't in path
my path follows:
path=whatever;g:\compilers\llvm\bin;g:\compilers\mingw64-64bit\bin
edit 1
i've know idea correct include paths, tried compilation in codelite found these:
"-ig:\\compilers\\mingw64-64bit\\x86_64-w64-mingw32\\include\\c++" "-ig:\\compilers\\mingw64-64bit\\x86_64-w64-mingw32\\include\\c++\\x86_64-w64-mingw32" "-ig:\\compilers\\mingw64-64bit\\lib\\gcc\\x86_64-w64-mingw32\\5.1.0\\include" "-ig:\\compilers\\mingw64-64bit\\lib\\gcc\\x86_64-w64-mingw32\\5.1.0\\include-fixed" "-ig:\\compilers\\mingw64-64bit\\x86_64-w64-mingw32\\include" "-ig:\\compilers\\mingw64-64bit\\x86_64-w64-mingw32\\include\\c++\\backward"
i'm using dialect flag --std=c++11
however simple program using c++ library giving me errors such as
g:\compilers\mingw64-64bit\x86_64-w64-mingw32\include\c++\bits/stringfwd.h:63:33: error: use of undeclared identifier 'char16_t' template<> struct char_traits<char16_t>; ^
edit 2
now passing x86_64-w64-mingw32
recommended martin, autodiscovery process seems work, produced executable freezes.
i found same when tried use vs2015 clang toolset
the code example using this
#include <iostream> int main() { int arr[] = {1, 2, 3, 4, 5}; for(auto el : arr) { std::cout << el << std::endl; } return 0; }
i compiling with:
clang++ -v --target=x86_64-w64-mingw32 hello.cpp -o test.exe -std=c++14
i have looked @ executable produced dependency walker , showing 64 bit compile , linking "g:\compilers\mingw64-32bit\bin\libstdc++-6.dll"
i think next step try compiling 32 bit version, cannot seem find correct target name that
i have tried clang++ hello.cpp -o main.exe -std=c++14 --target=i686-pc-mingw32 -v
that seems producing 32 bit executable, again freezes
note updated path point 32 bit clang.
edit 3
what find confusing until passed x86_64-w64-mingw32 target got similar errors both passing gcc paths, , default target of msvc both seemed related char16_t
, similar types
seeing thought try if passing target might fix vc compiler errors
whilst sort of seems work creates more problems, because keeps asking libs link , don't know correct ones
so tried:
clang++ hello.cpp -o main-vc.exe -std=c++14 --target=x86_64-pc-windows-msvc19.0.0 -v -xlinker "c:\program files (x86)\microsoft visual studio 14.0\vc\lib\amd64\libcmt.lib" "c:\program files (x86)\microsoft visual studio 14.0\vc\lib\amd64\libcpmt.lib" "c:\program files (x86)\microsoft visual studio 14.0\vc\lib\amd64\libvcruntime.lib" "c:\program files (x86)\windows kits\10\lib\10.0.10586.0\ucrt\x64\libucrt.lib"
i have no idea correct directories pass.
i have feeling need pass lib file getting error
libcmt.lib(thread_safe_statics.obj) : error lnk2019: unresolved external symbol __imp_closehandle
did change target? vc new default. use (example) x64, mingw:
clang++ --target=x86_64-w64-mingw32 test.cpp
don't forget linker wel.
Comments
Post a Comment