Have you read the errors? You will likely find that they tell you why line 6 is not what you expected. It reads like a declaration of a function called file() that takes a QString argument and returns a QFile, and not a local variable of type QFile. Remove the stuff from ( to ) and see how much further you get. You then need to focus on lne 18.