This is the kind of problem I work out how to solve, then I forget... and eventually have to do again... So more for my sake here is how to compile a python extension in c++ that has external libraries like opencv. Automatically wrapped with swig from distutils... So first up I have a random library of C++ that I want to use from python. One such C file is doing some low level math on an opencv IPL image. Since I want to use this in python but require it to be fast, I need to create an extension. // The header file I want to wrap. #include <stdio.h> #include <stdlib.h> #include <math.h> #include "cv.h" void remove_corneal_reflection(IplImage *image, IplImage *threshold_image, int sx, int sy, int window_size, int biggest_crr, int &crx, int &cry, int& crr, int *valid_point_calc); This has a few normal includes and "cv.h". This is refering to the opencv installed NOT in the default dir but in /usr/local/. Next is the instructions for
Ramblings about developing software. May contain traces of Java, Python, Scala, Typescript.