【问题标题】:Makefile command line arguments confused with MinGW directory pathsMakefile 命令行参数与 MinGW 目录路径混淆
【发布时间】:2017-11-20 16:02:59
【问题描述】:

我正在尝试运行make all 命令,但我得到一个非常令人困惑的错误,似乎'cl' 中的参数被误认为是MinGW 中的目录路径。我得到的输出:

cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DN
DEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\\src\\windows /DGFLAGS_DLL_DECL=
 /DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /I. -DUSE_GLOP -
DUSE_BOP -c examples\\cpp\\costas_array.cc /Foobjs\\costas_array.obj

这是 cl 命令,而不是警告和错误(注意 cl /EHsc 实际上会被误认为是 'C:/MinGW/MSYS/1.0/EHsc' 等...):

cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/EHsc', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/EHsc' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/MD', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/MD' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/nologo', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/nologo' ignored

...等...直到最后出现fatal error

cl : Command line warning D9024 : unrecognized source file type 'C:/MinGW/MSYS/1
.0/I.', object file assumed
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/I.' ignored
cl : Command line warning D9027 : source file 'C:/MinGW/MSYS/1.0/Foobjs/costas_a
rray.obj' ignored
costas_array.cc
examples\cpp\costas_array.cc(27): fatal error C1083: Cannot open include file: '
ortools/base/callback.h': No such file or directory
make: *** [objs\\costas_array.obj] Error 2

任何关于为什么会发生这种情况的帮助将不胜感激,我在这件事上不是很有经验。

【问题讨论】:

    标签: command-line mingw msys


    【解决方案1】:

    是 MSYS shell 为您做这些翻译以提供帮助。

    使用此 shell 中通常使用的工具,这没有问题,因为参数/选项以 ---(Unix 和/或 GNU 约定)开头。只要您需要遵循 Microsoft 的选项和标志约定的命令行工具,它就会开始为您服务,使用 /

    不幸的是,对于原始 MSYS,我不知道禁用此转换的方法。但是对于 MSYS2 有一个,see the question I asked about it:你只需要设置一个环境变量,例如

    export MSYS2_ARG_CONV_EXCL=\*
    

    所以,我的建议是您将工具升级到 MSYS2 并使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-25
      • 2017-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多