Change this line:
string word(line);
to
string word("line");
Update
To check whether the file was opened successfully...
ifstream file("output.txt");
if ( !file )
{
// Deal with error.
}
// Read the contents of the file.
To check whether the words are being read correctly...
while (file>>token)
{
std::cout << "Read the token: `" << token << "'" << std::endl;
if (word == token)
wcount++;
}