?? error: no suitable copy constructor

?? error: no suitable copy constructor

I'm trying to understand the following compiler error

1>OpsData\\PublicRoute.cpp(301): error: class "std::basic_ofstream" has no suitable copy constructor
1> list.Write( oFile ) ;

which would appear to stem from the definition

ofstream oFile ;

where ofstrem is defined in

If I check the function definition in nodelist.cpp

BOOL CPublicRouteNodeList::Write( ofstream oFile )

the ofstream definition also points back to the same definition in

I dont understand why the two defintions - which appear to be identical - wont work

What is trying to do here

I note thaat the code does compile with some other compilers

Any suggestioos?

advTHANKXance yet again




Downloadtext/x-c++src PublicRoute.cpp12.44 KB
Downloadtext/x-c++src Nodelist.cpp25.44 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Instead of trying to copy the parameter by value, copy it by reference, i.e.:

BOOL CPublicRouteNodeList::Write( ofstream& oFile )


Yup - that's it thankx.

Leave a Comment

Please sign in to add a comment. Not a member? Join today