[英]ISO C++ forbids declaration of '…' with no type
我收到了cpp编译器发出的警告,但似乎无法解决。 我至少想了解我在做什么错...
sketch \\ IRectangle.h:7:20:警告:ISO C ++禁止声明无类型的“矩形” [-fpermissive]
矩形(int,int);
^
头文件
#ifndef RECTANGLE_H
#define RECTANGLE_H
class IRectangle
{
public:
Rectangle(int,int);
void set_values (int,int);
int area (void);
private:
int width, height;
};
#endif
矩形实现
#include "IRectangle.h"
IRectangle::Rectangle(int width, int height)
{
}
void IRectangle::set_values (int a,int b)
{
}
int IRectangle::area()
{
return 0;
}
谷歌搜索后,我遇到了这个和这个线程,但如果原型符合我三重检查,所以我真的不能找出我做错了。
PS:在C ++中以“ I”作为前缀前缀可以吗?
构造函数必须具有与类相同的名称。 如果该类名为IRectangle
,则构造函数必须命名为IRectangle
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.