- Thanks for Stefan Fischerländer’s work(Stefan Fischerländer’s Blog)
-
Install Cygwin. Make sure that you also install gcc, g++, boost, make and gdb – you should find all of them within the Devel section of the Cywin installer.
-
Put your Cygwin home and Cygwin bin directory in your PATH variable. In my case I had to add C:\cygwin\home;C:\cygwin\bin; to my PATH variable. (Some help for changing the PATH variable.)
-
Now open a windows command prompt and execute the following statements: ‘gcc –version’, ‘g++ –version’, ‘make –version’ and ‘gdb –version’. You should get something like this:
C:\Dokumente und Einstellungen\sf>gcc --version
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Now install Netbeans. After installation, open Tools – Plugins. Under “Available Plugins” you should see “C/C++”. Install this plugin and restart Netbeans.
- Now open, again in Netbeans, Tools – Options – C/C++. In the section “Build Tools” click “Add ..” and choose your Cygwin bin directory (C:\cygwin\bin) as your base directory and click “Okay”. Netbeans now finds all your compiler and make tools from the Cygwin installation.
- In the section “Code Assistance” you have to choose the sub-section “C++ Compiler”. Add the include directory for your Boost libraries: In my installation this is C:\cygwin\usr\include\boost-1_33_1. Click “Okay”.
- Create a new Netbeans C++ project and write some code. Right click your project and choose “Set Configuration – Manage Configurations …”. In the “C++ Compiler” section, include the path to your Boost libraries int the “Include Directories” folder. My path is C:\cygwin\usr\include\boost-1_33_1.
- In the “Linker” section put your Cygwin bin directory (C:\cygwin\bin) in the “Additional Library Directories” field. Then edit the “Libraries” field below: Click “Add Library File …”, change file type to “.dll” and choose the libraries you need for your project. For my small regex example, I need cyboost_programm_options-gcc-mt-1_33_1 and cyboost_regex-gcc-mt-1_33_1. (ps:the dlls which are in cygwin\bin.)
- While editing your C++ file, hit F6 and Netbeans will compile, link and start your programm. You’re finally done.
This is my example code:
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
int main() {
string s = "This is my simple sample text, really.";
regex re(",|:|-|\\s+");
sregex_token_iterator my_iter(s.begin( ), s.end( ), re, -1);
sregex_token_iterator my_end;
while (my_iter != my_end)
cout << *my_iter++ << '\n';
return (EXIT_SUCCESS);
}
You can also build this little program on the command line. Open your Cygwin Bash Shell and navigate to your code directory. (Cygwin maps your windows drives under /cygdrive – thus cd /cygdrive/c/ navigates you to your windows C:\ drive.)
To compile your source file called regexp.cpp, just type:
g++ -c -I/usr/include/boost-1_33_1/ -o regexp.o regexp.cpp
And to link and build it:
g++ -o regexp.exe regexp.o -lboost_program_options-gcc-mt-s -lboost_regex-gcc-mt-s
That’s all. Now type ./regexp.exe to start your compiled program.
分享到:
相关推荐
《Boost C++ Libraries》是一本全面介绍Boost库的权威指南,Boost库是C++社区广泛使用的开源库,它为标准库提供了许多扩展和补充,涵盖了众多编程领域,如并发、泛型编程、算法、数学计算、序列化、图形界面等。...
Boost C++ Libraries Version 1.63.0 ,由 Windows + MinGW 编译通过,含头文件。 Boost编译指令:b2.exe --build-type=complete toolset=gcc variant=release link=static threading=multi runtime-link=static ...
#### 部分内容:“Solve practical programming problems using powerful, portable, and expressive libraries from Boost” - **知识点概述**:这部分内容强调了使用Boost库来解决实际编程问题的能力。它提到了...
### Boost C++ Libraries:概述与应用 #### 一、引言 Boost C++ Libraries是一组基于C++标准的现代库集合。这些库的源代码在Boost软件许可下发布,允许用户免费使用、修改和分发。Boost库是跨平台的,并支持大多数...
《Boost C++ Libraries 中文版》是一本详细阐述C++ Boost库的中文参考资料,它以CHM(Compiled Help Manual)格式提供,便于程序员快速查阅和学习。Boost库是C++编程语言的一个开源库集合,旨在提升C++的标准库功能...
With the exceptions noted below, this work is licensed under a Creative Commons Attribution - NonCommercial - NoDerivatives 4.0 International License. Visit ...
THE BOOST C++ LIBRARIES是一份自己编译的chm格式文档,描述了如何使用boost类库,目录如下: Front page Chapter 1: Introduction 1.1 C++ and Boost 1.2 Development Process 1.3 Installation 1.4 Overview ...
Boost项目(Boost C++ Libraries)是一个广泛使用的C++库集合,它提供了一系列广泛使用的任务和功能的实现,如智能指针、图形处理、数值分析、字符串和文本处理等。这些库几乎支持所有主流的操作系统,包括Windows、...
boost库,chm版,中文,有示例,有代码,可实践学习; 含智能指针、函数对象、事件处理、字符串处理、多线程、异步输入输出、进程间通讯、文件系统、日期与时间、序列化、词法分析器、容器、数据结构、错误处理、...
Boost C++库是跨平台的,并且由于拥有庞大的开发人员社区,它们能够获得包括Windows和Linux在内的不同操作系统的支持。 Boost库分为多个模块,每个模块都旨在解决特定的编程问题: 1. 智能指针:提供几种智能指针...
Boost is not just a collection of useful, portable, generic C++ libraries. It is an important incubator for ideas and concepts that make their way to the ISO C++ Standard itself. If you are involved ...
Learning Boost C++ Libraries Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, ...
然而,"Android port of Boost C++ Libraries.zip" 是一个专门为Android平台优化的Boost库版本,使得开发者能够在Android应用中利用Boost的强大功能。 这个移植版的Boost库可能包含了对Android NDK(Native ...
编译好了的官方boost帮助文件,方便查询。
关于boost_1_86_0.tar.gz,这是Boost C++ Libraries的一个压缩包版本,包含了Boost库的所有源代码和必要的文件,用于在Linux、Windows等操作系统上进行编译和安装。
Boost C++ Libraries 是一个广泛使用的开源库集合,专为 C++ 开发者设计,提供了大量高效、可移植的工具和组件。这些库经过同行评审,确保了代码质量、可靠性和性能,是 C++ 社区的重要贡献之一。Boost 的目标是增强...