CMake英特尔Fortran编译器无法编译简单的程序

时间:2016-04-25 18:40:15

标签: compilation cmake intel-fortran

我正在使用CMake在Windows下准备Fortran项目。我在VC2015上安装了一些入口Fortran编译器,当我cmake出现以下错误时

-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe  -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestFortranCompiler.cmake:54 (message):
  The Fortran compiler "D:/Program Files (x86)/Microsoft Visual Studio
  14.0/VC/bin/ifc.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: D:/Dev/plaf/build/CMakeFiles/CMakeTmp

  Run Build Command:"nmake" "/NOLOGO" "cmTC_f7da8\fast"

        "D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f
  CMakeFiles\cmTC_f7da8.dir\build.make /nologo -L
  CMakeFiles\cmTC_f7da8.dir\build

  Building Fortran object
  CMakeFiles/cmTC_f7da8.dir/testFortranCompiler.f.obj

        "D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe" -c
  D:\Dev\plaf\build\CMakeFiles\CMakeTmp\testFortranCompiler.f -o
  CMakeFiles\cmTC_f7da8.dir\testFortranCompiler.f.obj

  usage: D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe
  [subcommand] [options...]

    subcommands:
      OBJ            Convert an interface file into a dummy object file which can be archived into a static lib.
      EMBED          Embed an interface file into an existing static lib, producing a new lib.
      EXTRACT        Extract an embedded interface file from an existing static lib, producing the ifc.
      LOCATE         Find all embedded interface files and print their offset + size to stdout.

  NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio
  14.0\VC\bin\ifc.exe"' : return code '0x1'

我对错误的理解(如果我错了,请纠正我)是cmake正在使用带有错误标志的编译器,因此在示例程序编译期间它只是不起作用。

我该如何解决? (该错误似乎与我在大多数其他帖子中看到的不同)

1 个答案:

答案 0 :(得分:0)

当我使用MinGW进行编译时,它发生在我身上。解决方案是在配置CMake中选择“MinGW Makefile”而不是Visual Studio