Department of Engineering

IT Services

C++

wordle C++ is the object-oriented development of C with classes, member functions, operator overloading, constructors etc. It's the first language taught to undergraduates at CUED.

Starting C++

Local teaching

General Reference

Tutorials

Special topics

Advanced WWW resources

General

Maths 

Pointers

Programming

Other Topics

Local Information

General

Special topics

Types

Variables

Classes

Generic programming

Performance

Misc

Compilers and libraries

We have various IDEs (Integrated Development Environments) providing easy access to the compiler (which is g++ on the linux machines). Geany is used in the 1st year course. If you want to work away from CUED see

To use C++2011 on the central linux system, type

g++ --std=c++11

but note that the installed g++ is rather old and doesn't support all C++11 features. In particular it doesn't support regex. To use a newer version, try

/homes/tl136/gcc-5.4.0/installed/bin/g++ --std=c++11

With that version, the following should compile

#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string str("1231");
    std::regex r("^(\\d)\\d"); // entire match will be 2 numbers
    std::smatch m;
    std::regex_search(str, m, r);
    for(auto v: m) std::cout << v << std::endl;
}

To run the resulting program you'll need to have the environmental variable LD_LIBRARY_PATH set to /homes/tl136/gcc-5.4.0/installed/lib64. For example, if your program's called foo then the following should work if you're in foo's folder -

 export LD_LIBRARY_PATH=/homes/tl136/gcc-5.4.0/installed/lib64
 ./foo

producing the output

12
1

Integrated Development Environments

An Integrated Development Environment (IDE) offers integrated editing, compiling, debugging and project-management facilities. On the teaching system we currently have Anjuta (version 1) , Geany , NetBeans (with a C++ add-on), Eclipse and codeblocks

Anjuta
Anjuta 1. Click to zoom in

Geany. Click to zoom in
Netbeans
Netbeans. Click to zoom in
eclipse
Eclipse. Click to zoom in
eclipse
Codeblocks. Click to zoom in

FAQ