我一直在尝试将 AWS 开发工具包C++集成到我的 Netbeans 项目中。我尝试使用 cmake 命令,但它失败并出现以下错误。
这是在命令提示符下运行命令的文本
C:UsersjenseDesktopcode librariesaws-sdk-cpp-masteraws-sdk-cpp-master>"C:UsersjenseDesktopcode librariescmake-3.8.2-win64-x64cmake-3.8.2-win64-x64bincmake" .
-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Building AWS libraries as shared objects
-- Generating windows build config
-- Building project version: 1.1.10
-- The CXX compiler identification is GNU 5.3.0
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_ade23fast"
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- broken
CMake Error at C:/Users/jense/Desktop/code libraries/cmake-3.8.2-win64-x64/cmake-3.8.2-win64-x64/share/cmake-3.8/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler "C:/MinGW/bin/g++.exe" is not able to compile a simple
test program.
It fails with the following output:
Change Dir: C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_ade23fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_ade23fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:105 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeOutput.log".
See also "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeError.log".
这是我的CMakeError内部.txt
Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_a5997fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_a5997fast"
在我的CMakeOutput.txt
里
The CXX compiler identification is GNU, found in "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/3.8.2/CompilerIdCXX/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
它说g++
无法编译一个简单的测试程序,但它似乎在我的其他c++
程序上运行良好。此外,它指示我运行nmake
/NOLOGO
cmTC_a5997fast
.我的计算机上找不到安装的nmake,这是问题所在吗?或者这只是一连串错误中发生的另一个错误?
我该如何解决这个问题?
我使用的是Netbeans 8.2而不是Visual Studio。
我在SO上看到的所有答案似乎都与我的问题无关,它们是与Visual Studio相关的答案,或者解决我没有的问题。
谢谢!
NMake 是Microsoft工具链中的传统制作程序。由于您使用MinGW,因此您需要mingw32-make,但是CMake默认为Windows上的MS工具链生成器。使用-G "MinGW Makefiles"
调用CMake以切换到MinGW发生器。
-G "Unix Makefiles"
,就像Miles Budnek在问题的评论中建议的那样,是类Unix目标的默认生成器。例如,它是 Linux 上的默认设置。但是,它与MinGW不同,在您的情况下不起作用。
附言1:特别是在Windowsmake上使用所有CPU内核时存在问题。你可能想看看忍者。它通常是make的直接替代品,可以使用CMake的-G Ninja
激活,并且可以更好地处理并行构建。
附言2(与问题无关):避免在目录路径中的任何位置使用空格。这些是麻烦的主要来源,因为您必须在任何地方正确引用这些路径。这是(a)令人惊讶的困难,(b)你很容易完全忘记的东西,(c)所有第三方依赖项的构建系统也需要能够做到的事情。不使用空格是避免所有这些潜在陷阱的最简单方法。