error C2558: class 'std::basic_ifstream<_elem, _Traits>' : no copy constructor available or copy constructor is declared 'explicit'

Hi again,
When I now try to compile my code, I got the following error message:
error C2558: class 'std::basic_ifstream<_elem, _Traits>' : no copy constructor available or copy constructor is declared 'explicit'

Here's the code that doesn't compile now. I've put the "wrong" line between two lines like this: //--------------------------

//*************************** BEGINNING OF THE CODE
// edlaaf.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "cTimeCode.h"
#include "cEdlData.h"
#include "cToken.h"
#include "cLine.h"
#include "cEdl.h"
#include "cAafEdl.h"

const wchar_t* VersionString = L"21.1";
const unsigned int NumAudioChannels = NUM_AUDIO_CHANNELS;

wstring widen(const string & str) throw()
{
  const ctype<wchar_t>& char_facet = _USE(locale(),ctype<wchar_t>);
  wstring ret;
  ret.reserve(str.size());//avoid incremental allocation
  for(string::const_iterator it = str.begin(); it != str.end(); ++it)
  {
    ret += char_facet.widen(*it);
  }
  return ret;
}

int main(int argc, char* argv[])
{
  wcout << L"EDL to AAF converter. Version " << VersionString << L". Num Audio Channels = " << NumAudioChannels << endl;
  wcerr << L"EDL to AAF converter. Version " << VersionString << L". Num Audio Channels = " << NumAudioChannels << endl;

  if(argc != 3)
  {
    wcerr << L"Usage:\n\tedlaaf n file\nWhere:\n";
    wcerr << L"\tn is the edl fps (including the source material 1001 flag i.e. 30, 29.97, 25, 24, 23.98)\n";
    wcerr << L"\tfile is the edl file to convert (without the file extension)\n";
    return -1;
  }

  istringstream str(argv[1]);
  float fps = 0;
  str >> fps;

  if(fps != 30.00f &&
     fps != 29.97f &&
     fps != 25.00f &&
     fps != 24.00f &&
     fps != 23.98f)
  {
    wcerr << L"Error: Acceptable frames rates are: 30, 29.97, 25, 24 or 23.98\n";
    return -1;
  }

  string edlname(argv[2]);
  edlname += ".edl";

//------------------------------------------
wistream& in = wifstream(edlname.c_str());
//------------------------------------------
  if(in.fail())
  {
    wcerr << L"Error: Failed to open file " << widen(edlname.c_str()) << endl;
    return -1;
  }

  cAafEdl::Ptr data = new cAafEdl(fps);
  cEdl edl(data);

  wstring buffer;
  do {
    getline(in,buffer,in.widen('\n'));
    edl.addline(buffer);
  } while(in.good());

  edl.print();
  wcout << L"\n";

  edl.process();

  wstring aafname(widen(argv[2]));
  aafname += L".aaf";
  try
  {
    data->createAaf(aafname);
  }
  catch(HRESULT& hr)
  {
    if(AAFRESULT_FILE_EXISTS == hr)
    {
      wcerr << L"Error: " << aafname << L" already exists" << endl;
    }
    else
    {
      wcerr << L"Error: 0x" << hex << hr << L" while creating aaf file " << aafname << endl;
    }
  }

  return 0;
}

//*************************** END OF THE CODE

Thanks for your help
racinecondeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rajeev_devinCommented:
>> wistream& in = wifstream(edlname.c_str());
do this
wifstream in("file_name.txt");
0
rajeev_devinCommented:
Sorry this
wifstream in(edlname.c_str());
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
racinecondeAuthor Commented:
Hi Rajeev,
Can you please explain me the difference (if you got some time)? I'm a beginner in C++ (two weks) and any explanation is highly welcome...
Thanks again (you all) for your EFFICIENT help...

Regards,

Racine
0
rajeev_devinCommented:
wistream& in = wifstream(edlname.c_str());
If you are using this
then wifstream(edlname.c_str()); create an object of class wifstream.
And if you are expecting it to return something then it won't return.
Constructor has no return type :)

wistream& in = wifstream(edlname.c_str());
But this can be done if wifstream has a copy constructor.
0
racinecondeAuthor Commented:
Thanks very much for your time Rajeev...

Racine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.