有件事一直困扰着我。不能创建析构函数使用Xcode(与其他ide,如VS2021,这是没有问题的)。
我得到错误:
1. Constructor cannot be redeclared
2. Missing return type for function '˜Pointer'; did you mean the constructor name 'Pointer'?
如果我尝试在类外声明并取消注释*.cpp和*.hpp中的行,则错误变得更加疯狂。
我的<<p> strong> Pointers.hpp#ifndef Pointers_hpp
#define Pointers_hpp
#include <iostream>
class Pointer{
public:
Pointer(void);
˜Pointer(void){};
//˜Pointer(void);
};
#endif /* Pointers_hpp */
and mypointer .cpp是这个吗?
#include "Pointers.hpp"
Pointer::Pointer(void){};
//Pointer::˜Pointer(void){};
在网上搜索了几次之后,我找不到一个解决方案,有人能给我一个启示吗?
提前感谢,拉斐尔
解决感谢user4581301:
对于那些有同样问题的人。这里的问题是˜
和~
之间的相似性
正确的应该是~
如果你使用的是MacBook Pro短键为Option-N