Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > strange error m...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 44273 of 48044
Post > Topic >>

strange error message

by aaragon <alejandro.aragon@[EMAIL PROTECTED] > Mar 31, 2008 at 09:51 PM

Hi everyone,

Can someone explain me the weird error message that I got from this
simple code?

struct VTKP {
	std::ostream& os_;
	VTKP(std::ostream& os) : os_(os) {}
	void operator()(int i) {
		os_<<i<<endl;
	}
};

int main(int argc, char *argv[]) {

	std::ofstream 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::ofstream 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
 




 4 Posts in Topic:
strange error message
aaragon <alejandro.ara  2008-03-31 21:51:26 
Re: strange error message
"Jim Langston"   2008-03-31 22:02:18 
Re: strange error message
James Kanze <james.kan  2008-04-01 02:51:36 
Re: strange error message
aaragon <alejandro.ara  2008-04-01 22:10:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:33:22 CDT 2008.