我有一个类A(具有A.H和a.cpp文件),其中我进口到main.cpp中。我创建了一个类的对象,试图访问类的方法得到了一个未定义参考`A ::复位(unsigned int的*,无符号整型*)”。问题导入C++
我不知道什么是错在我的代码
//啊
#ifndef _A_H_
#define _A_H_
class A
{
public:
A();
void Reset();
};
#endif
//a.cpp:
#include "A.h"
A::A()
{
Reset();
}
void A::Reset()
{
}
//main.cpp
#include "A.h"
int main(int argc, const char * argv[])
{
A *aObj = new A;
aObj->Reset();
}
任何帮助,将不胜感激。
它是'A * aObj = new A;'。 'new'返回指针。 – Elazar 2013-04-28 07:14:07
'_A_H_'是[衰](http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier)。 – chris 2013-04-28 07:32:34
你正在使用什么编译命令?而“导入”不是C++的正确写法...... – 2013-04-28 11:20:10