Download>Using from C>g++

These instructions show how to setup a basic C++ project which uses the VLFeat library and the g++ compiler. Our project will consist of the following simple file, which we will refer to as main.cpp:

extern "C" {
  #include <vl/generic.h>

int main (int argc, const char * argv[]) {
  VL_PRINT ("Hello world!") ;
  return 0;

Notice that the extern "C" is required for C++ projects. Compiling the project is straightforward. From the command prompt type:

$ g++ main.cpp -o vlfeat-test -IVLROOT -LVLROOT/bin/a64/ -lvl

In this example, replace VLROOT with the path to your VLFeat installation and replace a64 with your architecture (a64 for 64 bit linux, glx for 32 bit linux).