在Windows上将不同于GCC的编译器附加到Clion IDE上

问题描述:

我正在用Clion和minigw-w64进行开发。 IDE使用cmake。在Windows上将不同于GCC的编译器附加到Clion IDE上

我发现了一个GCC中的错误,迫使我切换编译器,我别无选择。该错误与gcc如何处理堆栈对齐有关。 Clion似乎只支持windows上的minigw和cygwin,我相信这两个工具都使用gcc编译器。

有没有一种简单的方法让Clion/cmake使用不同的编译器?我已经读过,clang与GCC非常相似,因为它接受相同的编译器标志,所以我想知道这是否是一个好的选择。我也读过你可以通过改变一些标志来改变cmake使用的编译器,但我不知道在哪个文件中放置它,或者如果改变它将会破坏与Clion的兼容性。

CLion's FAQ

At present CLion supports GCC and Clang compilers and is guided by these two to get the libraries and headers paths. In the next releases we are planning to extend the list of compilers available in CLion.
To change the compiler, go to the Cache tab in CMake tool window and set the compiler’s path to the CMAKE_CXX_COMPILER variable. Then press Enter and click the Apply Changes and Reload button:

enter image description here

Search our issue tracker for feature requests about supporting other compilers to follow or vote on them, or add a new one if it’s missing.

+1

我不能得到这个工作。 Cmake不会编译。除了你所说的,我还尝试设置连接器和其他参数给叮当伙伴,仍然没有工作 – Thomas

+0

你究竟遇到什么问题?你有没有安装'clang'? –

+3

@MatsPetersson错误:C++编译器“clang ++ .exe路径在这里”不能编译一个简单的测试程序。当我尝试更新cmake缓存参数时会发生这种情况。 – Thomas