如何在window系统VS中设置boost编程环境
生活随笔
收集整理的這篇文章主要介紹了
如何在window系统VS中设置boost编程环境
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在windows系統中設置boost編程非常簡單:
1、下載boost軟件包
網址:http://www.boost.org/
最新版:http://www.boost.org/users/history/version_1_66_0.html
2、解壓到電腦中(例如,D:\boost),找到.bat文件,點擊,然后等待……
會在同一文件夾中生成兩個文件,見下圖,點擊b2.exe,等待……等待……,一直到編譯完成。
3、打開VS,建立工程。在工程屬性中,編譯和鏈接中設置如下圖所示:
4、舉個例子試試
/* 測試boost安裝是否成功 */ #include <boost/lexical_cast.hpp> #include <iostream> using namespace std; int main() {using boost::lexical_cast;int a = lexical_cast<int>("123");double b = lexical_cast<double>("123.0123456789");string s0 = lexical_cast<string>(a);string s1 = lexical_cast<string>(b);cout << "number: " << a << " " << b << endl;cout << "string: " << s0 << " " << s1 << endl;int c = 0;try{c = lexical_cast<int>("abcd");}catch (boost::bad_lexical_cast& e){cout << e.what() << endl;}getchar();return 0; }運行如下,表示沒有錯誤。
總結
以上是生活随笔為你收集整理的如何在window系统VS中设置boost编程环境的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【python初识】数据和对象
- 下一篇: 在 word 中 mathType 菜单