[glade--]glade compilation problem
- From: Matthew Britton <mbritton gps caltech edu>
- To: <glademm-list gnome org>
- Subject: [glade--]glade compilation problem
- Date: Thu, 15 Aug 2002 12:48:43 -0700 (PDT)
I had minor problems compiling glademm 1.1.1b under gcc 3.0.3.
In the file writers/image.cc, there was the following code:
void Gtk_Image::EmbedImage(CxxFile &f,const std::string &pixbuf) const
{ f.Declaration("static const unsigned char ");
f << Configuration.CName(pixbuf) << "_data[]";
f.Assignment().StartBlock().EndLine();
{ ifstream is((Configuration.pixmap_dir+"/"+pixbuf).c_str());
while (is.good())
{ unsigned char buf[16];
is.read(buf,sizeof buf);
size_t read=is.gcount();
f << '\t';
for (size_t x=0;x<read;++x) f << buf[x] << ',';
f << '\n';
}
}
f.EndBlock();
}
I had to add std:: to the ifstream constructor call. Also, in the read
call I had to cast buf from an unsigned char * to a char *, and sizeof buf
from an unsigned int to an int. Specifically,
void Gtk_Image::EmbedImage(CxxFile &f,const std::string &pixbuf) const
{ f.Declaration("static const unsigned char ");
f << Configuration.CName(pixbuf) << "_data[]";
f.Assignment().StartBlock().EndLine();
{ std::ifstream is((Configuration.pixmap_dir+"/"+pixbuf).c_str());
while (is.good())
{ unsigned char buf[16];
is.read((char*)buf,(int)sizeof buf);
size_t read=is.gcount();
f << '\t';
for (size_t x=0;x<read;++x) f << buf[x] << ',';
f << '\n';
}
}
f.EndBlock();
}
The code compiled and ran after these changes.
Many thanks
Matt
-----------------------------------------------------------------------
Dr. Matthew Britton email: mbritton gps caltech edu
Division of Geological and phone: +1 (626) 395-2415
Planetary Sciences fax: +1 (626) 585-1917
California Institute of Technology Office: 163 South Mudd
1200 E. California Blvd., M/S 150-21
Pasadena, CA 91125
-----------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]