[Gate-users] unable to compile Gate on OS X Lion: problems with std::ostringstream os(str, 100)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Dec 6 19:03:39 CET 2011


ever since upgrade I'm fighting with installation of Gate.

There are many errors, among them for example:

Entering source/arf ...
Compiling GateARFTableMgr.cc ...
In file included from src/GateARFTableMgr.cc:13:
In file included from ../arf/include/GateARFTableMgrMessenger.hh:27:
../general/include/GateUIcmdWithAVector.hh:124:22: error: no matching
constructor for initialization of 'std::ostringstream' (aka
  std::ostringstream os(st,100);
                     ^  ~~~~~~
/usr/include/c++/4.2.1/sstream:436:7: note: candidate constructor not
viable: no known conversion from 'int' to 'ios_base::openmode' (aka
'std::_Ios_Openmode') for 2nd argument
      basic_ostringstream(const __string_type& __str,
/usr/include/c++/4.2.1/sstream:416:7: note: candidate constructor not
viable: requires at most 1 argument, but 2 were provided
      basic_ostringstream(ios_base::openmode __mode = ios_base::out)
/usr/include/c++/4.2.1/bits/sstream.tcc:265:25: note: candidate
constructor (the implicit copy constructor) not viable: requires 1
argument, but 2 were provided
  extern template class basic_ostringstream<char>;
1 error generated.
make[1]: *** [../../tmp/Gate/GateARFTableMgr.o] Error 1
source/arf finished
Entering source/geometry ...

Google returns me hints that this code might be invalid, only not
shown as such when compiled with gcc. See:
Greping Geant4 sources doesn't reveal any single occurence of the same

Can somebody please help me out? How should I fix the code:

  char st[100];
  //std::ostrstream os(st,100);
  std::ostringstream os(st,100);
  for (G4int i=0; i<vec.size(); i++) os << vec[i] << " ";

to make it compile?

Thank you,

More information about the Gate-users mailing list