error LNK2001
一下是原题:typedef string Type;
Type initVal();
class Exercise
{
public:
typedef double Type;
Type setVal(Type);
Type initVal();
private:
int val;
};
Type Exercise::setVal(Type parm)
{
val = parm+initVal();
}
这是我更改后的:
typedef string Type;
Type initVal();
class Exercise
{
public:
typedef double Type;
Type setVal(Type);
Type initVal();
private:
int val;
};
Exercise::Type Exercise::setVal(Exercise::Type parm)
{
val = parm+Exercise::initVal();
return val;
}
一下是错误消息
--------------------Configuration: new1 - Win32 Debug--------------------
Compiling...
new1.cpp
Linking...
new1.obj : error LNK2001: unresolved external symbol "public: double __thiscall Exercise::initVal(void)" (?initVal@Exercise@@QAENXZ)
Debug/new1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
new1.exe - 2 error(s), 0 warning(s)