简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM