efoxxx 2002年03月29日
在Dev-C++下使用Boost库编译问题,先上50分!
就用《程序员》上的例子,编译竟然出了错误,向各位请教了。

#include <boost/lexical_cast.hpp>
#include <iostream>
#include <string>

int main(void)
{
using boost::lexical_cast;
int a = lexical_cast<int>("123");
double b = lexical_cast<double>("123.12");
std::cout<<a<<std::endl;
std::cout<<b<<std::endl;

system("PAUSE");
return 0;
}

编译错误为:
In file included from D:/Boost/boost/lexical_cast.hpp:25,
from d:\dev-c++\mine\test_lexical_c.cpp:1:
D:/DEV-C_~1/Include/G__~1/sstream:1: parse error before `::'
In file included from d:\dev-c++\mine\test_lexical_c.cpp:1:
D:/Boost/boost/lexical_cast.hpp: In function `Target boost::lexical_cast(Source)':
D:/Boost/boost/lexical_cast.hpp:52: parse error before `;'
D:/Boost/boost/lexical_cast.hpp: In function `int boost::lexical_cast<int, const char *>(const char *)':
d:\dev-c++\mine\test_lexical_c.cpp:8: instantiated from here
D:/Boost/boost/lexical_cast.hpp:56: `interpreter' undeclared (first use this function)
D:/Boost/boost/lexical_cast.hpp:56: (Each undeclared identifier is reported only once
D:/Boost/boost/lexical_cast.hpp:56: for each function it appears in.)

...全文
89 点赞 收藏 9
写回复
9 条回复

还没有回复,快来抢沙发~

发动态
发帖子
非技术区
创建于2007-09-28

4416

社区成员

5.8w+

社区内容

C/C++ 非技术区
社区公告
暂无公告