boost?????

kurt8276 2004-08-11 04:10:30
boost
#include <boost/lexical_cast.hpp>
#include <iostream>
int main()
{
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;
return 0;
}
这个为什么在vc++中不能编译通过?
using boost::lexical_cast;
int a =boost::lexical_cast<int>("123");
double b =boost::lexical_cast<double>("123.12");
std::cout<<a<<std::endl;
std::cout<<b<<std::endl;
return 0;
只有改为以上程序方可!

...全文
187 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
palluo 2004-08-12
  • 打赏
  • 举报
回复
就像在VC6中使用STL一样,前面必须加上,你要的东西在哪个名字空间中。
STL是前面加  std::
BOOST是前面加 boost::

其它的库,也很有可能是这样的,要多注意哦。
MyNameEPC 2004-08-11
  • 打赏
  • 举报
回复
要用 boost,就别用 VC6,该用 VC++.NET 2003。
rorot 2004-08-11
  • 打赏
  • 举报
回复
你的代码的写法正确,是vc6的问题,gcc下测试正确.
oldjackyone 2004-08-11
  • 打赏
  • 举报
回复
Hohooo...
nirvana_li 2004-08-11
  • 打赏
  • 举报
回复
啊,老大,使用命名空间啊。using namespace boost;忘了写吧???
sandrowjw 2004-08-11
  • 打赏
  • 举报
回复
hoho,我也碰到过的
qwertasdfg123 2004-08-11
  • 打赏
  • 举报
回复
同意楼上的。
RookieStar 2004-08-11
  • 打赏
  • 举报
回复
老兄,又中VC6的招了不是?

不是代码的问题,是编译器的问题,你也可以在最开始using namespace boost;
Boost libraries are developed by professionals, tested on multiple platforms and processor architectures, and contain reliable solutions for a wide range of tasks. This Cookbook takes you on a journey of simplifying the process of application development and guides you through writing perfect applications fast. “Boost C++ Application Development Cookbook” provides you with a number of clear step-by-step recipes that will help you take advantage of the real power of Boost and C++, while giving you a good grounding in using it in any project. “Boost C++ Application Development Cookbook” looks at the Boost libraries, and breaks down the mystery and confusion about which library to use in which situation. It will take you through a number of clear, practical recipes that will help you to take advantage of the readily available solutions. Boost C++ Application Development Cookbook starts with teaching the basics of Boost libraries that are now mostly part of C++11 and leave no chance for memory leaks. Managing resources will become a piece of cake. We’ll see what kind of work can be done at compile time and what Boost containers can do. Do you think multithreading is a burden? Not with Boost. Think writing portable and fast servers is impossible? You’ll be surprised! Compilers and operating systems differ too much? Not with Boost. From manipulating images to graphs, directories, timers, files, strings – everyone will find an interesting topic. You will learn everything for the development of high quality fast and portable applications. Write a program once and then you can use it on Linux, Windows, MacOS, Android operating systems. What you will learn from this book Get familiar with new data types for everyday use Use pointers to manage resources Get to grips with compile-time computations and assertions Use Boost libraries for multithreading Learn about Parallel execution of different task Perform common string-related tasks using Boost li

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧