您好我是新来的Visual Studio 2010 当我尝试建立我的代码,它告诉我:C++错误C2065:“值”:未声明的标识符-Newbe
count.cpp(18): error C2065: 'Value' : undeclared identifier
那是我count.cpp码发放错误:
#include "StdAfx.h"
#include "count.h"
count::count(void): Value(0), ResetValue(0){} //constructor
count::~count(void){} //destructor
int GetValue(){return Value;} //Accessor to get value by another class
这里是我的count.h代码:
#pragma once
class count
{
public:
count(void);
virtual ~count(void);
int GetValue();
private:
int Value;
int ResetValue;
};
这是将是使用计数对象d由一个countWindow对象。 所以我想要一个“GetValue”访问器,并使用countWindow对话窗口中的指针。
当我实际使用构造函数时,变量值是否在行12上未声明和启动? 还是不链接到count.h文件中的声明?
因为如果我创建另一个void函数来做一个Value ++,Visual Studio看起来很好用。
谢谢你的时间!