简体   繁体   English

C ++编译器错误消息

[英]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 错误C1075:匹配@ questions.cpp(10)左括号'{'之前的文件结尾

The error message is self explanatory. 该错误信息不言自明。

Take a look at the code in questions.cpp, where does the main function end? 看一下questions.cpp中的代码,主要功能在哪里结束? (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. (请记住,头文件是逐字包含的,因此请确保头文件的{与}的数目相同,并且没有被#ifdef删除。)注释Victor Sand提供的dasblinkenlight和Hot Licks都很好。

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. 目前的代码根本不使用Questions.h(现在,您已经注释掉了大部分实现),因此请尝试注释掉其中的内容,然后进行测试。 If it passes, the problem is in Questions.h. 如果通过,则问题出在Questions.h中。

Your problem is more than likely coming from Questions.h 您的问题很可能来自Questions.h

If you check that file you'll more than likely see no } at the end. 如果您检查该文件,那么最后很可能看不到}。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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