读书人

[Linker error]

发布时间: 2012-04-09 13:41:25 作者: rapoo

求救,[Linker error]
不知道哪里出问题了
----------------IntCell.h文件---------------------------
#ifndef IntCell_H
#define IntCell_H
class IntCell
{
public:
explicit IntCell(int intialValue=0);
int read() const;
void write(int i);

private:
int storedValue;
};
#endif


------------IntCell.cpp文件------------------------------
#include "IntCell.h"

IntCell::IntCell(int intialValue):storedValue(intialValue){}
int IntCell::read() const
{
return storedValue;
}

void IntCell::write(int i)
{
storedValue=i;
}









------------------------main文件-------------------------

#include <iostream>
#include "IntCell.h"
using namespace std;

int main()
{
IntCell m;
m.write(5);
cout<<m.read()<<endl;
cin.get();
return 0;

}




[解决办法]
没问题啊。。
什么编译器?
[解决办法]
用vc++6.0没问题哦,输出了一个5
[解决办法]
楼主换编译器吧,用VS2008或VS2010

读书人网 >C++

热点推荐