4

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
  • 697,062
  • 78
  • 1,055
  • 1,465
woodenToaster
  • 254
  • 1
  • 5
  • 12

2 Answers2

7

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
  • 697,062
  • 78
  • 1,055
  • 1,465
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
  • 24,056
  • 7
  • 61
  • 78