1.>d:\daily\cpp\friendly2\friendly2\complex.cpp(5): error C2143: 语法错误 : 缺少“;”(在“using”的前面)
原因是在 complex.h头文件中定义class complex{}最后没有加上引号, 万恶的引号
在C++中定义class的时候一定要在最后面添加引号
- #ifndef _COMPLEX_H_
- #define _COMPLEX_H_
- class Complex{
- private:
- int real_;
- int imag_;
- public :
- Complex();
- ~Complex();
- Complex(int x , int y);
- Complex& add(const Complex& c1);
- void display();
- }; 添加引号
- #endif//_COMPLEX_H_
转载于:https://blog.51cto.com/vincenttung/1174688