cmake-Problemen in Windows
Ich versuche zu kompilieren dieser (Recht Komplex) Stück code mit cmake und MinGW unter Windows:
#include <iostream>
int main()
{
std::cout << "Test" << std::endl;
return 0;
}
Dies ist die CMakeLists.txt
- Datei (die korrekt funktioniert in Linux):
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_C_COMPILER path/to/gcc)
SET(CMAKE_CXX_COMPILER path/to/g++)
project(cmake_test)
add_executable(a.exe test.cpp)
Mit dem Befehl:
cmake -G"MinGW Makefiles" .
Bekomme ich diese Fehler:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:20 (MESSAGE):
sh.exe was found in your PATH, here:
C:/MinGW/msys/1.0/bin/sh.exe
For MinGW make to work correctly sh.exe must NOT be in your path.
Run cmake from a shell that does not have sh.exe in your PATH.
If you want to use a UNIX shell, then use MSYS Makefiles.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/cmake_test/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/cmake_test/CMakeFiles/CMakeCXXCompiler.cmake
-- Configuring incomplete, errors occurred!
Diese Fehler hat mir nicht geholfen viel. Bedenkt, es funktioniert unter Linux, es muss etwas sein, was bezogen auf das Fenster Konfiguration.
Danke für jede Hilfe!!!
Konfiguration:
- Windows 7
- MinGW/GCC 4.6.1
- Die Fehlermeldung von CMake ist klar: Stellen Sie sicher, dass Sie nicht haben, sh in Ihrem Pfad. Das heißt: nicht CMake -G"MinGW Makefiles" von Ihrem MSys-prompt.
- Also, warum mit sh.exe in meinem Pfad ist ein problem?
- Durch ausführen
where sh.exe
ich fand es amC:\Cygwin64\bin\sh.exe
undC:\Program Files\OpenSSH
binsh.exe
. Wie sollte ich zu entfernenCygwin
undOpenSSH
main-Ordner, ohne Sie zu zerbrechen?
Du musst angemeldet sein, um einen Kommentar abzugeben.
Dies ist aufgrund, die Sie in Ihrem Pfad
C:/MinGW/msys/1.0/bin/
, für die Generierung von Projekten mit CMake und MinGW, löschen Sie Sie von Ihrem Pfad, und fügen SieC:/MinGW/bin/
stattC:\ProgramData\chocolatey\lib\msys2
. Ist das völlig unabhängig?Haben Sie möglicherweise bessere Ergebnisse mit
-G "MSYS Makefiles"
statt"MinGW Makefiles"
- aber ich warne Sie - es wird langsam sein.Entfernen sh.exe aus dem PFAD verbessert Ding.
Bekomme ich mehr Fehler, aber zu einem späteren Zeitpunkt...