A
aaragon
Hi everyone,
Can someone explain me the weird error message that I got from this
simple code?
struct VTKP {
std:stream& os_;
VTKP(std:stream& os) : os_(os) {}
void operator()(int i) {
os_<<i<<endl;
}
};
int main(int argc, char *argv[]) {
std:fstream dout;
dout.open("domain.vtp");
dout<<"<?xml version=\"1.0\"?>\n";
dout<<"<VTKFile type=\"PolyData\" version=\"0.1\" byte_order=
\"LittleEndian\">\n";
dout<<"<PolyData>\n";
dout<<"<Piece NumberOfPoints=\"";
VTKP(dout)(10); // <<<<<<-------------------------------- error
....
main.cxx: In function 'int main(int, char**)':
main.cxx:94: error: conflicting declaration 'VTKP dout'
main.cxx:88: error: 'dout' has a previous declaration as
'std:fstream dout'
make: *** [main.o] Error 1
and then I change that problematic line with
(VTKP(dout)(10));
and everything goes fine. I'm using GCC v4.3.
Thank you all,
aa
Can someone explain me the weird error message that I got from this
simple code?
struct VTKP {
std:stream& os_;
VTKP(std:stream& os) : os_(os) {}
void operator()(int i) {
os_<<i<<endl;
}
};
int main(int argc, char *argv[]) {
std:fstream dout;
dout.open("domain.vtp");
dout<<"<?xml version=\"1.0\"?>\n";
dout<<"<VTKFile type=\"PolyData\" version=\"0.1\" byte_order=
\"LittleEndian\">\n";
dout<<"<PolyData>\n";
dout<<"<Piece NumberOfPoints=\"";
VTKP(dout)(10); // <<<<<<-------------------------------- error
....
main.cxx: In function 'int main(int, char**)':
main.cxx:94: error: conflicting declaration 'VTKP dout'
main.cxx:88: error: 'dout' has a previous declaration as
'std:fstream dout'
make: *** [main.o] Error 1
and then I change that problematic line with
(VTKP(dout)(10));
and everything goes fine. I'm using GCC v4.3.
Thank you all,
aa