This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: compatibility


 
Hi.

Basically your problem is that the || operator is returning a boolean
value,
you actually need a ios_base::openmode that is the result of a bitwise
or
of the flags.



 fout.open("solid_position.dat",ios::out || ios::ate);

Should be:

 fout.open("solid_position.dat",ios::out | ios::ate);
                                        ^^^

Martin



-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Vortmann, Claas
Sent: 15 December 2004 07:42
To: gcc-help@gcc.gnu.org
Subject: compatibility

Hello,

I have a huge code that is running without problems under SuSE-Linux 8.0
(gcc version 2.95.3).

When I change to SuSE-Linux8.2 (gcc version 3.3), the code can not be
compiled anymore.

I've tracked down the problem to a very simple c++ testcase (see  below)
that shows the same behaviour, and produces the same error message.

------------------------------------------------------------------------
----- 

#include <fstream.h>
#include <iostream.h>

int main()
{

 ofstream fout;
 fout.open("solid_position.dat",ios::out || ios::ate);

return 0;
}
------------------------------------------------------------------------
------------ 


The error message says (find the complete error message attached) :

hallo.cpp:13: error: no matching function for call to `
  std::basic_ofstream<char, std::char_traits<char> >::open(const
char[19],
  bool)'

Since I dont want to change the syntax (iostream.h -> iostream etc.) of
the huge code, I thought of including some old libraries during the
linking process.
Unfortunately without success.

I would be glad, if somebody can give me a hint.
Thanks in advance
Claas




The complete error message:
----------------------------------

In file included from /usr/include/g++/backward/fstream.h:31,
                from hallo.cpp:1:
/usr/include/g++/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header. Please
consider using one of the 32 headers found in section 17.4.1.2 of the 
C++ standard. Examples include substituting the <X> header for the <X.h>
header for C++ includes, or <sstream> instead of the deprecated header
<strstream.h>. To disable this warning use -Wno-deprecated.
hallo.cpp: In function `int main()':
hallo.cpp:13: error: no matching function for call to `
  std::basic_ofstream<char, std::char_traits<char> >::open(const
char[19],
  bool)'
/usr/include/g++/fstream:686: error: candidates are: void
  std::basic_ofstream<_CharT, _Traits>::open(const char*,
std::_Ios_Openmode =
  (std::ios_base::out | std::ios_base::trunc)) [with _CharT = char,
_Traits =
  std::char_traits<char>]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]