expected unqualified-id before string constant

故事扮演 提交于 2019-12-03 01:19:22

This is a simple problem.

You just forgot the semi colon at the end of your header file.

The compiler errors you get for missing the semi colon at the end of a class definition are very hard to relate to the actual problem - just get in the habit of checking that when you get errors after you create a class.

Another way to produce this error: define a macro to a string constant, and later, use the macro name as the name of a string constant. Example

#define FOO "bar"
static const char FOO[] = "bar"; // <-- Error "expected unqualified-id before string constant".

The obvious answer is to remove one of the definitions, or change the name of one.

Your code has multiple problems:

  • You need to fully qualify names(void oscillators::print_table() instead of just void print_table()) in oscillators.cpp
  • You probably need to #include "oscillators.h" into oscillators.cpp
  • You need to properly declare variables in implementation
  • Add missing semicolons.

But I guess that specific error is caused by missing semicolon after class definition in header file. Just add it like:

    std::vector<double> gtable_; // Will contain a wavetable with a guard point.
};
#endif
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!