转自 http://yongshengfree.blog.163.com/blog/static/3525246520081023255997/

刚开始以为头文件语法写错了  经常碰到,记录一下

不过在查阅网上资料的时候也意外的收获了一些答案, 在此把它贴出来, 以示警醒:

You can get the error

expected class-name before ‘{’ token

if you try to define a class as a subclass, and the superclass isn't defined in the local scope.

WRONG

 class Foo: public Bar   // Foo is a subclass of Bar
 {
   // stuff
 };

RIGHT

 #include "Bar.h"         // this makes Bar recognized
 class Foo: public Bar   
 {
   // stuff
 };

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
猜你喜欢
  • 2021-07-07
  • 2021-10-21
  • 2021-04-24
  • 2022-12-23
  • 2021-10-28
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案