2015-05-28 87 views
0

我仍然試圖在Windows上構建VTK。我已經安裝了Cygwin,我已經完成了CMake的配置工作。然而,我正面臨着你可以在下面截圖中看到的錯誤:當我想使用GNU make時,make命令嘗試通過MS Visual Studio進行創建。我猜這是來自makefile本身,它可能會強制這種行爲或從我的Cygwin設置。Visual Studio使用Cygwin代替GNU Make

在此先感謝您的幫助

enter image description here

Makefile文件內容:

# CMAKE generated file: DO NOT EDIT! 
# Generated by "MinGW Makefiles" Generator, CMake Version 3.2 

# Default target executed when no arguments are given to make. 
default_target: all 
.PHONY : default_target 

# Allow only one "make -f Makefile2" at a time, but pass parallelism. 
.NOTPARALLEL: 

    #============================================================================= 
# Special targets provided by cmake. 

# Disable implicit rules so canonical targets will work. 
.SUFFIXES: 

# Remove some rules from gmake that .SUFFIXES does not remove. 
SUFFIXES = 

.SUFFIXES: .hpux_make_needs_suffix_list 

# Suppress display of executed commands. 
$(VERBOSE).SILENT: 

# A target that is always out of date. 
cmake_force: 
.PHONY : cmake_force 

    #============================================================================= 
# Set environment variables for the build. 

SHELL = cmd.exe 

# The CMake executable. 
CMAKE_COMMAND = "C:\Program Files (x86)\CMake\bin\cmake.exe" 

# The command to remove a file. 
RM = "C:\Program Files (x86)\CMake\bin\cmake.exe" -E remove -f 

# Escaping for special characters. 
EQUALS = = 

# The top-level source directory on which CMake was run. 
CMAKE_SOURCE_DIR = C:\Users\Lonni\VTK\VTK-6.2.0 

# The top-level build directory on which CMake was run. 
CMAKE_BINARY_DIR = C:\Users\Lonni\VTK\Build1 

    #============================================================================= 
# Targets provided globally by CMake. 

# Special rule for the target edit_cache 
edit_cache: 
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running   CMake cache editor..." 
    "C:\Program Files (x86)\CMake\bin\cmake-gui.exe" -H$(CMAKE_SOURCE_DIR) - B$(CMAKE_BINARY_DIR) 
.PHONY : edit_cache 

# Special rule for the target edit_cache 
edit_cache/fast: edit_cache 
.PHONY : edit_cache/fast 

# Special rule for the target rebuild_cache 
rebuild_cache: 
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running  CMake to regenerate build system..." 
    "C:\Program Files (x86)\CMake\bin\cmake.exe" -H$(CMAKE_SOURCE_DIR) - B$(CMAKE_BINARY_DIR) 
.PHONY : rebuild_cache 

# Special rule for the target rebuild_cache 
rebuild_cache/fast: rebuild_cache 
.PHONY : rebuild_cache/fast 

# The main all target 
all: cmake_check_build_system 
    $(CMAKE_COMMAND) -E cmake_progress_start  C:\Users\Lonni\VTK\Build1\CMakeFiles  C:\Users\Lonni\VTK\Build1\CMakeFiles\progress.marks 
    $(MAKE) -f CMakeFiles\Makefile2 all 
    $(CMAKE_COMMAND) -E cmake_progress_start  C:\Users\Lonni\VTK\Build1\CMakeFiles 0 
.PHONY : all 

# The main clean target 
clean: 
    $(MAKE) -f CMakeFiles\Makefile2 clean 
.PHONY : clean 

# The main clean target 
clean/fast: clean 
.PHONY : clean/fast 

# Prepare targets for installation. 
preinstall: all 
    $(MAKE) -f CMakeFiles\Makefile2 preinstall 
.PHONY : preinstall 

# Prepare targets for installation. 
preinstall/fast: 
    $(MAKE) -f CMakeFiles\Makefile2 preinstall 
.PHONY : preinstall/fast 

# clear depends 
depend: 
    $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check- build-system CMakeFiles\Makefile.cmake 1 
.PHONY : depend 

#============================================================================= 
# Target rules for targets named vtk-android 

# Build rule for target. 
vtk-android: cmake_check_build_system 
    $(MAKE) -f CMakeFiles\Makefile2 vtk-android 
.PHONY : vtk-android 

# fast build rule for target. 
vtk-android/fast: 
    $(MAKE) -f CMakeFiles\vtk-android.dir\build.make CMakeFiles/vtk- android.dir/build 
.PHONY : vtk-android/fast 

#============================================================================= 
# Target rules for targets named vtk-compile-tools 

# Build rule for target. 
vtk-compile-tools: cmake_check_build_system 
    $(MAKE) -f CMakeFiles\Makefile2 vtk-compile-tools 
.PHONY : vtk-compile-tools 

# fast build rule for target. 
vtk-compile-tools/fast: 
    $(MAKE) -f CMakeFiles\vtk-compile-tools.dir\build.make CMakeFiles/vtk- compile-tools.dir/build 
.PHONY : vtk-compile-tools/fast 

# Help Target 
help: 
    @echo The following are some of the valid targets for this Makefile: 
    @echo ... all (the default if no target is provided) 
    @echo ... clean 
    @echo ... depend 
    @echo ... vtk-android 
    @echo ... edit_cache 
    @echo ... rebuild_cache 
    @echo ... vtk-compile-tools 
.PHONY : help 



#============================================================================= 
# Special targets to cleanup operation of make. 

# Special rule to run CMake to check the build system integrity. 
# No rule that depends on this can have commands that come from listfiles 
# because they might be regenerated. 
cmake_check_build_system: 
    $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check- build-system CMakeFiles\Makefile.cmake 0 
.PHONY : cmake_check_build_system 

編輯:讓--version給我:

/usr/bin/make --version 
GNU Make 4.0 
Construit pour x86_64-pc-cygwin 
Copyright (C) 1988-2013 Free Software Foundation, Inc. 
Licence GPLv3+ : GNU GPL version 3 ou ultérieure <http://gnu.org/licenses/gpl.html> 
Ceci est un logiciel libre : vous êtes autorisé à le modifier et à la redistribuer. 
Il ne comporte AUCUNE GARANTIE, dans la mesure de ce que permet la loi. 

type -a make 
make est un alias vers « /usr/bin/make » 
make est /usr/bin/make 
make est /usr/bin/make 
+0

'/ usr/bin/make --version'輸出是什麼? –

+0

我編輯我的帖子,以顯示什麼使版本給我 – LBes

+0

我沒有問'make --version'。我問過'/ usr/bin/make --version'(你在屏幕截圖中運行它的方式)。這是否給出相同的輸出? 'type -a make'輸出也是什麼? –

回答

1

的問題makefile文件在第二行中有解釋:

# Generated by "MinGW Makefiles" Generator, CMake Version 3.2 

您生成的makefile文件是用於MinGW而不是Cygwin make。您看到Windows命令提示符(CMD)的原因是由於以下行:

SHELL = cmd.exe 

這會導致make使用cmd.exe作爲shell調用所有命令。這就是MinGW通常做的事情,但Cygwin的make期望調用一個採用Unix Bourne shell類型參數的shell。參數最終被cmd忽略,然後它的行爲就像沒有任何啓動一樣。

您要麼重新生成makefile,以便與Cygwin兼容或安裝MinGW並使用它編譯它。

+0

這是完全正確的。我使用正確的生成器(Unix)重新運行CMake,現在我有一個兼容的Makefile。問題仍然是我現在得到一個C編譯器「C:/ cygwin64/bin/cc」不能編譯一個簡單的測試程序。也許它來自我的cygwin環境 – LBes

+0

一個可能的原因在這裏解釋:http://stackoverflow.com/questions/4101456/running-cmake-on-windows – LBes