invalid conversion from `UCHR* const' to `const char

Hembree, Dr. Louis louis.hembree@nrlmry.navy.mil
Tue Oct 31 01:42:00 GMT 2006


I am trying to compile an older version of Isearch and am getting the
following error:

make[1]: Entering directory
`/users/hembree/pdss/src/Isearch-1.47a-modified/Isearch/src'
g++ -g -m32 -fwritable-strings -Wall -Wno-unused -DUNIX  
g++ -DVERS=\"1.47a\" -I../doctype -I../src -o string.o -c string.cxx
cc1plus: note: -fwritable-strings is deprecated; see documentation for
details
string.cxx: In function `std::ostream& operator<<(std::ostream&, const
STRING&)':
string.cxx:577: error: invalid conversion from `UCHR* const' to `const
char*'
string.cxx:577: error:   initializing argument 1 of
`std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::write(const _CharT*, std::streamsize) [with _CharT = char,
_Traits = std::char_traits<char>]'

In an include file we have

typedef unsigned char UCHR;
typedef size_t STRINGINDEX;

In the STRING class definition we have
.
.
  friend      ostream& operator<<(ostream& os, const STRING& str);
  friend      istream& operator>>(istream& os, STRING& str);
.
.

  STRINGINDEX         Length;
  UCHR               *Buffer;
 ..

In the code we have 
.
.
ostream& operator<<(ostream& os, const STRING& str) {
  os.write(str.Buffer, str.Length);
  return os;
}
.
.

The error occures at os.write.

Any suggestions.

Thanks in advance.

Louis Hembree
Naval Research Laboratory
7 Grace Hopper Ave.
Monterey, CA  93943-5502
PH: 831-656-4787
Fax: 831-656-4767



More information about the Gcc-help mailing list