c++ - Compiling Cython with C header files error -


so i'm trying wrap c code cython. read read applied cython's tutorials on doing (1, 2), these tutorials not on how compile code once have wrapped cython, , have error saying can't find c code.

first, cython script ("calcrmsd.pyx"):

import numpy np cimport numpy np  cdef extern "rsmd.h":     double rmsd(int n, double* x, double* y)  #rest of code ommited 

the c code trying wrap ("rmsd.h"):

#include <string.h> #include <stdio.h> #include <stdlib.h> #include <math.h>  extern "c" {   // svd lapack   void dgesvd_(char*,char*,int*,int*,double*,int*,double*,double*,int*,double*,            int*,double*,int*,int*); }  double rmsd(int n, double* x, double* y) {    //code omitted } 

setup.py

from distutils.core import setup distutils.extension import extension cython.distutils import build_ext cython.build import cythonize import numpy np   setup(     ext_modules = cythonize([extension("calcrmsd",                              sources = ["calcrmsd.pyx"],                             include_dirs = [np.get_include()],                             libraries = ["dgesvd"]                             #extra_compile_args = ["-i."],                             #extra_link_args = ["-l./usr/lib/liblapack.dylib"]                             )])  )  

my error:

calcrmsd.c:269:10: fatal error: 'rsmd.h' file not found #include "rsmd.h" 

i read stack overflow thread using cython link python shared library

but following gives me different errors. if try put rmsd.h in sources, says doesnt recognize file type.

how link custom c (which needs special linking options compile) cython?

this looks promising im not sure how use it.

please help!

first of has find include file, rsmd.h. need add path header can found include_dirs parameter. error missing file should disappear.

then additionally need include library compiling c code. if that's librsmd.a add 'rsmd' libraries parameter. additionally might need library_dirs parameter contains path library can found.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -