Changing compiler from MinGW32 to clang in CodeLite (Windows) results in compilation errors

丶灬走出姿态 提交于 2019-12-06 05:29:21

To make things simpler: I am pretty sure that clang is not ready for Windows development. Other than code completion library, I have not seen a single production application successfully compiled with clang under MSW.

Note that I did manage to build a simple hello world, but it failed miserably when running it (especially when exception are involved)

Long story short: stick to MinGW (gcc) for Windows, its the most reliable thing you will get

Here the output of building a simple hello world with codelite on my machine (using clang 3.4 downloaded from LLVM website, and letting codelite detect it from settings->build settings->auto detect compilers):

C:\Windows\system32\cmd.exe /c "C:/MinGW-4.8.1/bin/mingw32-make.exe -j8 SHELL=cmd.exe  -e -f  Makefile"
"----------Building project:[ ClangHW - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'D:/src/TestArea/ClangHW'
D:/software/LLVM/bin/clang++.exe   -c  "D:/src/TestArea/ClangHW/main.cpp" -g -O0 -Wall  -o ./Debug/main.cpp.o -Ic:/mingw-4.8.1/lib/gcc/mingw32/4.8.1/include/c++ -Ic:/mingw-4.8.1/lib/gcc/mingw32/4.8.1/include/c++/mingw32 -Ic:/mingw-4.8.1/lib/gcc/mingw32/4.8.1/include/c++/backward -Ic:/mingw-4.8.1/lib/gcc/mingw32/4.8.1/include -Ic:/mingw-4.8.1/include -Ic:/mingw-4.8.1/lib/gcc/mingw32/4.8.1/include-fixed  -I. -I.
D:/software/LLVM/bin/clang++.exe  -o ./Debug/ClangHW @"ClangHW.txt" -L.
mingw32-make.exe[1]: Leaving directory 'D:/src/TestArea/ClangHW'
0 errors, 0 warnings

It compiles fine, however, when I run it - it prints the "hello world" message and crashes instantly

Note that the reason that clang is using MinGW include paths, is simple: it does not come with its own header files, instead it relies on their existence (codelite uses your "default" MinGW compiler include paths and uses them for clang)

To conclude: I strongly recommend you to stick to MinGW or VC

Eran (Author of CodeLite IDE)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!