Projects 2008

Regular Expressions in C++ using NetBeans and Boost

Programmers will find really attractive Netbeans and its plugins. This blog focusses in how to use Regular Expressions in C++ using NetBeans and Boost. The following instructions have been tested in both Ubuntu 7.10 and 8.04

1. Install bcp which extracts the Boost libraries
sudo apt-get install bcp

2. If you haven’t installed NetBeans do so
sudo apt-get install netbeans

If the instruction above does not work, seach in Synaptic Package Manager, and if it also fails check the   Software/Sources(System/Administration)
For our particular objective, Netbeans must be version 6.0.1, so update it if required.
Install the C++ plugin from the start page

3. Now that you have installed NetBeans, C++, Boost, the only thing missing before the writing programs is setting up Boost in NetBeans

Need the path of Boost, type in the terminal: ‘whereis boost’
Usually, it is located in: /usr/include/boost
This path must be copied in: tools/options/code assistance/c++

Finally, right click in the project
Set Configuration/Manage Configuration and in Linker/Additional Options type: -lboost_regex

For additional arguments such as an input file, type in:
Run/Arguments

If you want to use just the terminal and an editor such as gedit, install bcp, and in the terminal type:

g++ -o regex_program regex.cpp -lboost_regex
./regex_program

I recommend ‘Regular Expression Plugin’ in Netbeans

In Tools/Plugin
To open: Search for regular, and install ‘Regular Expression Plugin’
Tools/Plugin/regular expression plugin

It can be also be downloaded, and after install within NetBeans

Programming Examples
http://www.onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html?page=4
http://ubuntuforums.org/showthread.php?p=5862093

All about configuration
http://www.boost.org/

For windows’ folks

http://www.fischerlaender.net/development/using-boost-c-libraries-with-gcc-g-under-windows

October 11, 2008 Posted by aes | C, developer | | 1 Comment

C section

GCC and G++ are running by default in Ubuntu and most Linux distributions.

However, base on your software sources, these compilers may not included. To solve this issue type in the terminal:

sudo apt-get install build-essential
 
Compiling and running C, C++ programs with gcc and g++ respectively

If there is a Makefile file just type: ‘make’ . Otherwise:
Compile: gcc -o program_name program_name.c (cc compiler can also be used)
Run: ./program_name

gcc: warning messages
These usually appear because of missing libraries
http://www.joeandmotorboat.com/2005/06/30/gcc-error-warning-implicit-declaration-of-function/

To use excpl function in c, it must include the path of the command to use. To find out such path use whereis command
http://www.opengroup.org/onlinepubs/000095399/functions/exec.html

Regular Expressions in C++ using Netbeans and Boost

Linking with external libraries
http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html
http://tldp.org/HOWTO/Program-Library-HOWTO/index.html

How to run a c++ executable program in a machine that does not have c++ installed?
Answer: Link its libraries statically, therefore it’s translated into assembly
I use the following instructions:

g++ -Wall -g -c program_name.cpp -o program_name.o
g++ -g -o program_name_static program_name.o -L. /path/library.a

C help
http://www.cplusplus.com/doc/tutorial/
http://www.skytopia.com/project/articles/compsci/c-help.html

September 13, 2008 Posted by aes | C | | No Comments Yet