1.>d:\daily\cpp\friendly2\friendly2\complex.cpp(5): error C2143: 语法错误 缺少“;(在“using”的前面)

原因是在 complex.h头文件中定义class complex{}最后没有加上引号, 万恶的引号

C++中定义class的时候一定要在最后面添加引号


    
    
    
    
  1. #ifndef _COMPLEX_H_ 
  2. #define _COMPLEX_H_ 
  3. class Complex{ 
  4. private: 
  5. int real_; 
  6. int imag_; 
  7. public : 
  8. Complex(); 
  9. ~Complex(); 
  10. Complex(int x , int y); 
  11. Complex& add(const Complex& c1); 
  12. void display(); 
  13. };  添加引号 
  14. #endif//_COMPLEX_H_