error using file streams
a9028033@unet.univie.ac.at
a9028033@unet.univie.ac.at
Wed Feb 25 16:14:00 GMT 2004
Hi!
After compiling the code my binary exit with error at the following lines:
unsigned int rsu_output_interval;
int rsuTimewidth, rsuTimeprecision;
int rsuValuewidth, rsuValueprecision;
string filename_rsu;
string filename_rsuRef;
string filename_rsuMW;
string filename_rsuMWRef;
string dirname_rsu;
ostringstream* rsubuff;
ostringstream* rsuRefbuff;
ostringstream* rsuMWbuff;
ostringstream* rsuMWRefbuff;
ofstream* RSU;
ofstream* RSUref;
ofstream* RSUMW;
ofstream* RSUMWRef;
if(rsu_on || rsuRef_on || rsuMW_on || rsuMW_on)
{
rsu_output_interval = rsu_parameters.get_parameter()["usuc_sampling_interval"];
rsuTimewidth = rsu_parameters.get_parameter()["usucTimewidth"];
rsuTimeprecision = rsu_parameters.get_parameter()["usucTimeprecision"];
rsuValuewidth = rsu_parameters.get_parameter()["usucValuewidth"];
rsuValueprecision = rsu_parameters.get_parameter()["usucValueprecision"];
string dirname_rsu = path_series + "/USUCSeries";
command = "mkdir -p " + dirname_rsu;
charptr = const_cast<char*>(command.c_str());
system(charptr);
DefaultParset::setinitSeries();
if(rsu_on)
{
filename_rsu = dirname_rsu + "/usucSeries.ts";
rsubuff = new ostringstream();
rsubuff->setf(std::ios::showpoint | std::ios::fixed, std::ios::floatfield);
RSU = new ofstream(filename_rsu.c_str(), std::ios::trunc | std::ios::out | std::ios::app);
DefaultParset::registerSeries(rsubuff, RSU, filename_rsu, " ");
if(!(*RSU))
{
cerr << filename_rsu << " could not be opened!" << endl;
exit(-1);
}
The problem is the line 'if(!(*RSU))' where the pointer is not dealed
correctly, I think.
The output from ddd is the following:
(gdb) print RSU
$3 = (basic_ofstream<char,std::char_traits<char> > *) 0x817c568
(gdb) next
(gdb) print !(*RSU)
warning: can't find class named `std::basic_ofstream<char, std::char_traits<char> >', as given by C++ RTTI
warning: can't find class named `std::basic_ofstream<char, std::char_traits<char> >', as given by C++ RTTI
warning: can't find class named `std::basic_ofstream<char, std::char_traits<char> >', as given by C++ RTTI
warning: can't find class named `std::basic_ofstream<char, std::char_traits<char> >', as given by C++ RTTI
$4 = true
(gdb) next
(gdb) next
(gdb) print *RSU
warning: can't find class named `std::basic_ofstream<char, std::char_traits<char> >', as given by C++ RTTI
$5 = {<basic_ostream<char,std::char_traits<char> >> = {<basic_ios<char,std::char_traits<char> >> = {<ios_base> = {static boolalpha = 1, static dec = 2, static fixed = 4, static hex = 8, static internal = 16, static left = 32, static oct = 64, static right = 128, static scientific = 256, static showbase = 512, static showpoint = 1024, static showpos = 2048, static skipws = 4096, static unitbuf = 8192, static uppercase = 16384, static adjustfield = 176, static basefield = 74, static floatfield = 260, static badbit = 1, static eofbit = 2, static failbit = 4, static goodbit = 0, static app = 1, static ate = 2, static binary = Internal: global symbol `_ZNSt8ios_base6binaryE' found in ios.cc psymtab but not in symtab.
_ZNSt8ios_base6binaryE may be an inlined function, or may be a template function
(if a template, try specifying an instantiation: _ZNSt8ios_base6binaryE<type>).
Does anybody have an idea what the problem is?
Regards, Iavor
More information about the Gcc-help
mailing list