这已经回答了。然而,对于使用有问题的测井仪的人,请执行以下操作:
在标题变化:
const int LOG_WRITE = ios::out;
const int LOG_APPEND = ios::app;
到
const std::ios_base::openmode LOG_WRITE = std::ios::out;
const std::ios_base::openmode LOG_APPEND = std::ios::app;
更改初始化函数从int
到std::ios_base::openmode
,例如
..., std::ios_base::openmode mode)
使用int与OSX一起使用,但在RHEL 5.10中失败。一旦我做出上述更改,它就可以在RHEL 5.10上运行。
OSX:
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
RHEL 5.10:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /SDK/GCC/objdir/../gcc-4.8.3/configure
Thread model: posix
gcc version 4.8.3 (GCC)
在OSX的类型定义为:
typedef unsigned int openmode;
typedef openmode open_mode;
static const openmode app = 0x01;
static const openmode ate = 0x02;
static const openmode binary = 0x04;
static const openmode in = 0x08;
static const openmode out = 0x10;
static const openmode trunc = 0x20;
+1 - 我猜'的std :: _ ios_Openmode'是应该用于可移植代码的['std :: ios_base :: openmode'](http://www.cplusplus.com/reference/iostream/ios_base/openmode/)的typedef。 – vstm
@vstm是的,thx指出了。 –
我最终完全删除了该代码中的日志记录功能,因为整个事情都是在假设它是'int'的情况下完成的。我不明白为什么他们提供的编译示例有一个工作日志功能... – natli