【问题标题】:CLion not using the correct compiler?CLion 没有使用正确的编译器?
【发布时间】:2017-12-08 23:37:19
【问题描述】:

当我在 CLion 环境中运行 cmake 时,我得到了这个输出。当我在 CLion 之外运行时,我没有收到任何警告,并且一切正常。

真正奇怪的部分是我为编译器指定了 clang 和 clang++,我在 CC 和 CXX 环境变量以及 CLion 的工具链设置中执行此操作,但它说 g++ 和 gcc 有错误.但是,我在 CLion 的任何配置中都没有提到 gcc 或 g++。

这些来自哪里,我该如何解决?如果能从我的 IDE 中实际构建这个项目,那就太好了。

这些问题在 CLion 2017.3 更新后开始出现。

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G "CodeBlocks - Unix Makefiles" /home/rkratt/src
-- The C compiler identification is Clang 3.9.0
-- The CXX compiler identification is Clang 3.9.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Building src in Debug mode.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rkratt/src/cmake-build-debug

Problems were encountered while collecting compiler information:
    g++: error: unrecognized command line option '-fopenmp=libomp'
    gcc: error: unrecognized command line option '-fopenmp=libomp'

[Finished]

【问题讨论】:

    标签: clion


    【解决方案1】:

    Ryan,CMake 似乎将 g++/gcc 与您项目中的特定目标相关联。我怀疑建筑也会失败。你能检查一下吗?

    如果您无法解决问题,请提交a ticket,我们会尽力提供帮助。

    【讨论】:

    • 是的,构建也失败了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-17
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    • 1970-01-01
    • 2021-03-25
    • 1970-01-01
    相关资源
    最近更新 更多