Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

?? error: no suitable copy constructor

jim_cox
Beginner
2,143 Views

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

Jimmy

=mjc=

.


0 Kudos
1 Solution
Judith_W_Intel
Employee
2,143 Views

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

BOOL CPublicRouteNodeList::Write( ofstream& oFile )

Judy

View solution in original post

0 Kudos
2 Replies
Judith_W_Intel
Employee
2,144 Views

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

BOOL CPublicRouteNodeList::Write( ofstream& oFile )

Judy

0 Kudos
jim_cox
Beginner
2,143 Views
Yup - that's it thankx.
0 Kudos
Reply