【问题标题】:Qt Linux to Windows transition: Error in macro substitutionQt Linux 到 Windows 的转换:宏替换错误
【发布时间】:2021-01-26 10:40:08
【问题描述】:

我有一个 Qt 项目(版本 5.14.2),它在 Linux 下构建得很好。现在我也想在 Windows 上提供它。但是,我在构建它时遇到了一些麻烦。抛出以下错误:

Error: Cannot find = after : in macro substitution.

然后是makefile中的一行。当我转到该行时,有这个命令:

443   {C:\Users\Alex\Documents\GitHub\control-station\src\aircraft}.cpp{obj\}.obj::
444   $(CXX) -c $(CXXFLAGS) $(INCPATH) -Foobj\ @<<
445   $<
446   <<

我以前没有使用 Windows 的经验,所以这个错误让我一无所知。下面还有一个错误:

Kit Desktop Qt 5.14.2 MSVC2017 64bit has configuration problems.

看起来这是前一个的连续,但我不确定。你有什么建议要检查吗?好像是宏错误,不知道从哪里下手?

【问题讨论】:

  • 没有足够的信息来提供有用的答案。您使用 QMake 或 CMake 还是只使用 Make(然后是哪个 Make - windows 或 unix 变体?)。源文本中没有关于位置的行信息,我们无法知道导致此错误的代码是什么样的。
  • @BitTickler Jeah 抱歉,如果您不知道是什么原因,很难提供足够的信息。但是我发现了问题并在这里回答了。我的 .pri 文件中使用了 Git shell,但未正确安装。

标签: c++ windows qt qmake


【解决方案1】:

没关系,找到了解决方案。问题完全隐藏在代码的其他地方。我正在使用一些 git shell 命令:

exists ($$PWD/.git) {
    GIT_DESCRIBE = $(shell git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
    GIT_BRANCH   = $(shell git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
    GIT_HASH     = $(shell git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
    GIT_TIME     = $(shell git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)

但是没有正确安装 git shell。这以某种方式传播到 make 文件并导致错误。

【讨论】:

    猜你喜欢
    • 2015-10-25
    • 2016-07-20
    • 1970-01-01
    • 1970-01-01
    • 2021-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多