我已经在Windows 7 Enterprise和10上安装了CMake 3.14.4(来自cmake-3.14.4-win64-x64.msi)和GCC 5.1.0(来自tdm64-gcc-5.1.0-2.exe)主页(64位)。
我正在尝试从cpp / hpp源文件github sources.构建一个.LIL
,CMakeLists.txt引用了COTS安装中的包含目录。包含目录中的头文件具有if-else,并且CMake构建总是由于落入下面的最后一个else块而出错:
# if defined(_M_AMD64)
# include <wchar.h>
# if BIP_CXX11_SUPPORT
typedef char16_t CciChar;
# else
typedef wchar_t CciChar;
# endif
typedef __int64 CciInt;
typedef unsigned __int64 CciCount;
# define __CCI_WINDOWS__
# else
# error The C plugin interface for IBM Integration Bus is only available
for 64-bit Windows x86-64 systems
#endif
步骤:
1. c:\iib-swm\build>cmake -DIIB_INSTALL_DIR=C:\Progra~1\IBM\IIB\10.0.0.12
-G "MinGW Makefiles" ../source
-- The CXX compiler identification is GNU 5.1.0
-- Check for working CXX compiler: C:/software/C++Tools/tdm-
gcc/bin/g++.exe
-- Check for working CXX compiler: C:/software/C++Tools/tdm-
gcc/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/iib-swm/build
这是此步骤之后CMakeSystem.cmake的内容:
set(CMAKE_HOST_SYSTEM "Windows-6.1.7601")
set(CMAKE_HOST_SYSTEM_NAME "Windows")
set(CMAKE_HOST_SYSTEM_VERSION "6.1.7601")
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_SYSTEM "Windows-6.1.7601")
set(CMAKE_SYSTEM_NAME "Windows")
set(CMAKE_SYSTEM_VERSION "6.1.7601")
set(CMAKE_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)
2. c:\iib-swm\build>cmake --build .
-- Configuring done
-- Generating done
-- Build files have been written to: C:/iib-swm/build
[ 33%] Building CXX object
CMakeFiles/statsdsw.dir/StatsdStatsWriter.cpp.obj
In file included from
C:/Progra~1/IBM/IIB/10.0.0.12/server/include/plugin/BipCci.h:14:0,
from
C:/Progra~1/IBM/IIB/10.0.0.12/server/include/plugin/BipCsi.h:14,
from C:\iib-swm\source\StatsdStatsWriter.hpp:13,
from C:\iib-swm\source\StatsdStatsWriter.cpp:10:
C:/Progra~1/IBM/IIB/10.0.0.12/server/include/plugin/BipCos.h:170:4:
error: #error The C plugin inter
face for IBM Integration Bus is only available for 64-bit Windows x86-
64 systems
# error The C plugin interface for IBM Integration Bus is only
available for 64-bit Windows x86-64
systems
^
CMakeFiles\statsdsw.dir\build.make:62: recipe for target
'CMakeFiles/statsdsw.dir/StatsdStatsWriter.
cpp.obj' failed
mingw32-make.exe[2]: ***
[CMakeFiles/statsdsw.dir/StatsdStatsWriter.cpp.obj] Error 3
CMakeFiles\Makefile2:71: recipe for target
'CMakeFiles/statsdsw.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/statsdsw.dir/all] Error 130
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 130
我什至无法理解,即使CMake将系统处理器识别为AMD64,它也不会转换为包含.h文件中的_M_AMD64
吗?我已经在网上拖曳了CMake和相关资源。尝试以管理员身份运行CMake,缩短了git项目克隆到没有运气的路径。
PS:我唯一用cpp刷的是15年前的Uni,所以如果我想念C的话,请怜悯我的领主(和女士们)。
答案 0 :(得分:0)
_M_AMD64
似乎特定于Visual Studio编译器。这个问题令人困惑,因为它表明CMake正在进行预处理。没有。您正在使用gcc
。 gcc
似乎没有实现Visual Studio特定的预处理器宏。
您将不得不更改代码以与gcc
一起使用,或者使用target_compile_definitions
之类的CMake命令自己定义缺少的宏。
请注意,README文件表示要使用Visual Studio 2015在Windows上进行构建。