I try to run the example from the documentation, but I get errors.
#include <iostream>
#include <string>
#define HFFIX_NO_BOOST_DATETIME
#include "hffix.hpp"
int main()
{
char buffer[512];
hffix::message_writer writer(buffer, buffer + 512);
writer.push_back_header();
writer.push_back_string(hffix::tag::MsgType, "0");
writer.push_back_string(hffix::tag::SenderCompID, "AAAA");
writer.push_back_string(hffix::tag::TargetCompID, "BBBB");
writer.push_back_int(hffix::tag::MsgSeqNum, 1);
//writer.push_back_timestamp(hffix::tag::SendingTime, boost::posix_time::microsec_clock::universal_time());
writer.push_back_trailer();
std::cout.write(writer.message_begin(), writer.message_size()) << std::endl;
std::cout << "Wrote " << writer.message_size() << " bytes to buffer." << std::endl;
return 0;
}
c:\tmp\hffix>g++ t.cc -o t
In file included from t.cc:6:0:
hffix.hpp:1560:9: error: a class-key must be used when declaring a friend
hffix.hpp:1560:9: error: friend declaration does not name a class or function
hffix.hpp: In member function 'const hffix::message_reader::const_iterator& hffix::message_reader::begin() const':
hffix.hpp:1414:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'const hffix::message_reader::const_iterator& hffix::message_reader::end() const':
hffix.hpp:1424:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'const hffix::message_reader::const_iterator& hffix::message_reader::message_type() const':
hffix.hpp:1434:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'const hffix::message_reader::const_iterator& hffix::message_reader::check_sum() const':
hffix.hpp:1444:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'const char* hffix::message_reader::message_end() const':
hffix.hpp:1486:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'size_t hffix::message_reader::message_size() const':
hffix.hpp:1496:35: error: 'logic_error' is not a member of 'std'
hffix.hpp: In member function 'void hffix::message_reader_const_iterator::increment()':
hffix.hpp:1641:24: error: 'hffix::message_reader::const_iterator hffix::message_reader::end_' is private
hffix.hpp:1693:57: error: within this context
hffix.hpp:1646:14: error: 'void hffix::message_reader::malformed()' is private
hffix.hpp:1695:43: error: within this context
hffix.hpp: At global scope:
hffix.hpp:3186:1: error: global qualification of class name is invalid before '{' token
I use g++ under windows.
c:\tmp\hffix>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/opt/mingw32/bin/../libexec/gcc/mingw32/4.5.1/lto-wrapper.exe
Target: mingw32
Configured with: ../../src/gcc-4.5.1/configure --build=mingw32 --enable-languages=c,ada,c++,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable
-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-nls --disable-win32-registry --disable-symvers --pre
fix=/mingw --disable-werror --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://
Thread model: win32
gcc version 4.5.1 (tdm-1)