1
刚刚开始将我的项目移至Xcode,并且在尝试构建我的项目时,我的构造函数定义中出现错误。 在默认构造函数上,我得到“预期的成员名称或';'后声明说明符”,并在其他构造我得到:C++ Xcode构造函数错误
- ‘预期‘)’’
- 字段有不完全类型‘按钮::按钮’
- 非交友类成员‘串’不能有资格的名字
#include <string>
#ifndef BUTTON_H
#define BUTTON_H
namespace interface1
{
class Button
{
private:
std::string name;
float xPos;
float yPos;
float width;
float height;
public:
//Default constructor
Button::Button();
//Constructor with id, x, y, width and height parameters
Button::Button(std::string, float, float, float, float);
//Getters and setters
std::string getName();
float getX();
void setX(float);
float getY();
void setY(float);
float getWidth();
void setWidth(float);
float getHeight();
void setHeight(float);
bool isClicked(int, int);
void draw(int, float, float, float, float);
};
}
#endif
任何想法会出错?
摆脱'Button ::'。 – chris 2013-03-05 15:42:42
谢谢。我如何在Visual Studio中使用它,而不是xCode? – user1356791 2013-03-05 15:45:27
你在VS中不需要它 – badgerr 2013-03-05 15:48:23