Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1183342
  • 博文数量: 181
  • 博客积分: 6155
  • 博客等级: 准将
  • 技术积分: 1805
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-05 09:24
文章分类

全部博文(181)

文章存档

2015年(2)

2014年(3)

2013年(9)

2012年(29)

2011年(30)

2010年(36)

2009年(40)

2008年(32)

分类: C/C++

2011-12-28 14:22:18

错误:
错误 1 error LNK2019: 无法解析的外部符号 "class std::basic_ifstream > & __cdecl open_file(class std::basic_ifstream > &,class std::basic_string,class std::allocator > const &)" (),该符号在函数 _main 中被引用 word_transform.obj 10.1
 
 
问题出在那个open_file这个函数好像是他自己写的。然后你在下面没有实现。。。
只有一个声明。。。

ifstream& open_file(ifstream&, const string&);

其源码如下:
ifstream& open_file(ifstream &in, const string &file)
{
in.close(); // close in case it was already open
in.clear(); // clear any existing errors
// if the open fails, the stream will be in an invalid state
in.open(file.c_str()); // open the file we were given
return in; // condition state is good if open succeeded
}
加上就可以运行了。


-------------------------------------------------------------------
如果你用的是VC6.0的话,就是project-> setting -> debug
在里面的program arguments,而你用的是VS2008,应该是差不了太多。。。。
实在不行,你链接生成EXE之后,用命令行定位到那个文件夹,然后带参数执行。
阅读(1514) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~