Richie Joel MG
Richie Joel MG

Reputation: 33

C++ compiler error message

Im still new to programing, ive started a draft project and coppied the code into anther project but when i try to debug i get this error message i dont know whats going on. Can anyone help me please ?

    // this is my code

    #include "Questions.h"

    #include <iostream>
    #include <fstream>

    using namespace std;    

    int main(void)
    {
      ofstream myfile;
      myfile.open ("Questions.txt");
      myfile << "Writing this to a file.\n";
      myfile.close();
      return 0;        
    }

The error says

error C1075:end of file before the left brace '{' at @questions.cpp(10) was matched

Upvotes: 0

Views: 144

Answers (2)

Captain Skyhawk
Captain Skyhawk

Reputation: 3500

Your problem is more than likely coming from Questions.h

If you check that file you'll more than likely see no } at the end.

Upvotes: 1

Arafangion
Arafangion

Reputation: 11908

The error message is self explanatory.

Take a look at the code in questions.cpp, where does the main function end? (Keep in mind that the header files are included verbatim, so make sure that the header file has the same number of {'s as it has for }'s, and that they aren't #ifdef'ed out.) The comments provided by Victor Sand, dasblinkenlight, and Hot Licks are all good.

Your code as it stands is not using Questions.h at all (any more, now that you've commented out the majority of the implementation), so try commenting that include out and then testing. If it passes, the problem is in Questions.h.

Upvotes: 2

Related Questions