Tabla de Contenidos

C++ Notes

Notes about the language

Maps

Libraries

Use

Lets consider your /usr/local/lib/libYARP_OS.a. What you can do is, have -L/usr/local/lib/ in your makefile as one of the variables. And then you can have -lYARP_SO appended to the LDLIBS.

-L is for path to the lib and -l is the lib name here libYARP_OS.a will be passed as -lYARP_OS. On command line you would do something like: gcc -o main main.c -L/usr/local/lib/ -lYARP_SO. This should give you an idea.

C++11

Auto

ofRectangle rectangle = ofGetCurrentViewport();
//is the same as
auto rectangle = ofGetCurrentViewport();
 
//and
 
const ofRectangle rectangle = ofGetCurrentViewport();
//is the same as
const auto rectangle = ofGetCurrentViewport();
 
float x = rectangle.x;
//is the same as
auto x = rectangle.x;
 
//and
 
float & x = rectangle.x;
//is the same as
auto & x = rectangle.x;

Foreach

for (auto mySelfie : mySelfies) { ... }
// To use a reference rather than a copy
for(auto & mySelfie : mySelfies) { ... }

Override

This does not produces an error:

class BuildingProjectionMapper {
public:
//...
    virtual void mapTheGreekColumns();
//...
};
 
class AutoBuildingProjectionMapper : public BuildingProjectionMapper {
public:
	void mapTheGreekColums(); // woops, I spelt column incorrectly
};

To solve this:

class AutoBuildingProjectionMapper : public BuildingProjectionMapper {
public:
	void mapTheGreekColums() override;
};

Tips