pythonc++ubuntu

on c++(on ubuntu) what i must configure for the compiler find the imports?(like iostream,stdio,math,etc)


I have Ubuntu, Python 2.7, Intel C/C++ Compiler. Supose i have a file called voronoi.cpp,that uses these imports(or any others):

#include "Python.h"
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <vector>


#ifndef FLT_MAX
    double FLT_MAX=std::numeric_limits<double>::max( );
#endif


double round(double x, int precision) {
    double p = pow(double(10), precision);
    double r = floor(x * p + 0.5) / p;
    return r;
}

bool equals(double x1, double y1, double x2, double y2, double precision) {
    double p = pow(10, -0.9* precision);
    return fabs(x1 - x2) <= p && fabs(y1 - y2) <= p;
}

double p2p_distance(double x1, double y1, double x2, double y2) {
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
.
.
.

My question is: When i go to compile this file, the compiler, where gonna look in my system for the imports? Or, the same question but in a different form, where i must put the files "Python.h", "VoronoiDiagramGenerator.h", <math.h> and for the compiler find them? or what i must configure for the compiler find the imports?


Solution

  • It is built into the compiler. The GCC compiler will look in /usr/include, /usr/local/include, /usr/include/c++/4.8/...

    The Intel compiler, since it isn't the default system compiler, will probably use its own directories.

    Any #include statement that uses the double quotes will look in the same directory as the source code file first. After that I think it will try /usr/include, etc.