【问题标题】:Meson build system - change compiler to g++介子构建系统 - 将编译器更改为 g++
【发布时间】:2021-03-01 08:23:45
【问题描述】:

这是我的 meson.build

project('lab1', 'cpp',
        version: '0.1.5')

executable('lab1', 
           'main.cpp', 
           'Graph.cpp', 
           'Matrix.cpp', 
           'menuUtils.cpp',
           cpp_args : '-Wall'
          )

问题是:

Sanity check compile stderr:
c++: error: D:\Programming\?++ programming\Discrete-Math\lab1\builddir\meson-private\sanitycheckcpp.cc: Invalid argument
c++: fatal error: no input files
compilation terminated.

-----

meson.build:1:0: ERROR: Compiler c++ can not compile programs.

似乎介子正在尝试使用 Microsoft 编译器进行编译。我不想要它,我想将它更改为我通常使用的 g++。谷歌搜索后,我意识到我必须更改 CXX 变量,但我该怎么做呢?

【问题讨论】:

  • @JHBonarius 我读过,但我还是不明白。
  • 你设置CC了吗?见第一段。 “CC 指的是宿主平台的编译器,即用于编译运行在我们最终将安装项目的机器上的程序的编译器。”
  • @JHBonarius 我应该在我的环境变量中设置它吗?
  • 嗯,我不知道。我不知道你的系统、你的设置、你的后端、你的意图等。没有普遍的正确答案,它是具体的。我认为该站点上的文档非常好(例如Running Meson)。您应该阅读并按照步骤操作。

标签: c++ meson-build


【解决方案1】:

首先,要将编译器更改为 g++,我添加了一个新的环境变量 CXX,其值为 g++。在 Windows 操作系统上,只需搜索 Edit the system environment variables,然后单击 Environment Variables

然后将CXX 设置为适当的值。

现在 CXX 已设置。

我的问题是:

Sanity check compile stderr:
g++: error: D:\Programming\?PP_programming\Discrete-Math\lab1\builddir\meson-private\sanitycheckcpp.cc: Invalid argument
g++: fatal error: no input files
compilation terminated.

就你所见,有一个“?”路径中的符号。最初我的路径如下所示:

所以介子以某种方式将“C”字母更改为“?”象征。这导致了一个问题。要解决此问题,只需重命名文件夹即可。

【讨论】:

    猜你喜欢
    • 2021-01-12
    • 2018-03-10
    • 2017-09-04
    • 2019-12-14
    • 2013-03-07
    • 1970-01-01
    • 2021-09-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多