0
#include <iostream>
class ObjectInfo{
private:
static float Rotation;
public:
//sets object rotation value
void SetR(float a){ static float Rotation = a; }
//print roation value (I think this is where the problem is located)
void PrintR(){ std::cout << Rotation;}
};
int main()
{
ObjectInfo Wall;
//set float var
float Rotation;
//Get user set rotation
std::cin >> Rotation;
//set wall rotation
Wall.SetR(Rotation);
//print wall rotation value
Wall.PrintR();
std::cin >> Rotation;
}
錯誤1錯誤LNK2001:無法解析的外部符號 「私人:(?旋轉@ ObjectInfo @@ 0MA)靜浮ObjectInfo ::旋轉」解析的外部符號「私人:靜浮ObjectInfo ::旋轉
錯誤2錯誤LNK1120:1周無法解析的外部
這是一個樣機我量身定做的,我不知道如何解決該錯誤
是否anynyone知道什麼可能導致此錯誤
?我得到相同的錯誤,如果我嘗試返回值,然後couting該值。
有沒有人知道一個alteriate解決方案來重新從類的價值?
特別是這個答案:http://stackoverflow.com/a/12574407/1413395 –