Friday 5 January 2018

c++ - Why am I getting this error: expected ')' before '&' token?

itemprop="text">

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
#include
"Translator.h"

#include


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.


itemprop="text">
class="normal">Answer



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) {

...

}


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...