我正在尝试将我的办公代码从 C++ 迁移到 C++11,并且我们大量使用 STLPorts。
有一个编译器宏 ( http://www.stlport.org/doc/configure.html ) - _STLP_LONG_LONG,在我们的代码中使用并且在 C++ 中运行良好。
但是,在 C++ 11 中,这是没有定义的。
#if defined (_STLP_LONG_LONG)
// Doesn't come here
我怎样才能解决这个问题?我尝试在互联网上搜索,但资源非常有限。
编辑:这是代码
# if defined (_STLP_MSVC) || defined (__BORLANDC__) || defined (__ICL)
# define ULL(x) x##Ui64
typedef unsigned _STLP_LONG_LONG uint64;
# elif defined (_STLP_LONG_LONG) /// <---- Here
typedef unsigned _STLP_LONG_LONG uint64;
# define ULL(x) x##ULL
# elif defined(__MRC__) || defined(__SC__) //*TY 02/25/2000 - added support for MPW compilers
# include "uint64.h" //*TY 03/25/2000 - added 64bit math type definition
# else
# error "there should be some long long type on the system!"
# define NUMERIC_NO_64 1
# endif
据我所知,代码试图为给定平台找到一个 long long 类型。在 linux 上的 pre C++11 的情况下,g++ 转到指定的行。但是当我执行 g++ -std=c++11 ... 时,g++ 会跳过这一行并出现错误“系统上应该有歌曲 long long 类型!”