简体   繁体   English

如何在 MacOS 上将 Clion 上的编译器从 clang 更改为 gcc?

[英]How to change compiler on Clion from clang to gcc on MacOS?

The only compiler that works on my CLion is the clang one which is detected by default in toolchains.唯一适用于我的 CLion 的编译器是 clang 编译器,它在工具链中默认检测到。 I need to use gcc (my college class grades using the gcc compiler so I want to avoid any unexpected issues) and have it installed through homebrew.我需要使用 gcc(我的大学班级成绩使用 gcc 编译器,所以我想避免任何意外问题)并通过自制软件安装它。 In my terminal I can do g++ and gcc commands and it uses the right compiler, but I don't know how to change it in CLion.在我的终端中,我可以执行 g++ 和 gcc 命令并且它使用正确的编译器,但我不知道如何在 CLion 中更改它。 I must be doing something wrong with the location of it or the CMake settings.我一定是在它的位置或 CMake 设置上做错了什么。 Any guidance would be appreciated and thank you.任何指导将不胜感激,谢谢。 Let me know if there's any additional questions I can answer, my explanation may be insufficient as I am new to the world of CS.如果还有其他问题可以回答,请告诉我,我的解释可能不够充分,因为我是 CS 世界的新手。 I see previous questions on how to switch compilers between gcc and clang, but not specifically on CLion.我看到了以前关于如何在 gcc 和 clang 之间切换编译器的问题,但不是特别针对 CLion。

The LANG part specifies the language (C for C and CXX for C++), and you need to provide the full path to the compiler LANG部分指定语言(C 代表 C,CXX 代表 C++),您需要提供编译器的完整路径

  • After you apply the settings, CLion will reset the CMake cache and reload your project.应用设置后,CLion 将重置 CMake 缓存并重新加载您的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM