首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

,[Linker error]

2012-04-09 
求救,[Linker error]不知道哪里出问题了----------------IntCell.h文件---------------------------#ifnde

求救,[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

热点排行