5

I assume it has something to do with the #includes, but this is my first time trying to use them so I'm a little lost. I just wondered if anyone could tell immediately if there was an obvious mistake.

 /** @file Translator.cpp */

#include <fstream>
#include "Translator.h"
#include <vector>

Translator(std::ifstream& fin)  //error appears on this line
{
    T1(fin);
    T1.createTable(fin);
    T2(fin);
    T2.createTable(fin));
    string temp;
    while(!fin.eof())
    {
    fin >> temp;
    message.push_back(temp);
    }
}

Thanks for your time.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
woodenToaster
  • 264
  • 1
  • 4
  • 13

2 Answers2

8

It is hard to answer this question exactly without seeing the header, but if this is a function, you need to add a return type of void to the definition of your function:

void Translator(std::ifstream& fin) {
    ...
}

If this is a constructor, you need to provide its qualified name:

Translator::Translator(std::ifstream& fin) {
    ...
}
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
1

Without the declaration of Translator it's a bit hard to say, but if it's meant to be a constructor, then it should be Translator::Translator(std::ifstream& fin). If it's meant to be a method, then it should have a return type specified, so something like void Translator(std::ifstream& fin).

Yuushi
  • 25,132
  • 7
  • 63
  • 81