mercredi 1 juillet 2015

Libclang don't follow include statement

I'm trying to use Libclang to programatically analyse the Opencv library, but when I try to import the main header from Opencv opencv.hpp, libclang won't follow the path.

Previously, it was reading everything quite beautifully, but then I figured it was following my $PATH's headers, and I want it to follow these specifics ones.

opencv.hpp is a file containing lots of #include statements like so:

#include "core/core_c.h"
#include "core/core.hpp"
#include "flann/miniflann.hpp"
// ... and so on

but, when I try to open it with libclang, or either clang ./opencv.hpp, it won't follow:

clang ./Header_Example/opencv.hpp
./Header_Example/opencv.hpp:46:10: fatal error: 'core/core_c.h' file not found
#include "core/core_c.h"
         ^
1 error generated.

but I'm sure it is on the right directory (a bit of my tree output):

── Header_Example
│   ├── opencv.hpp
│   ├── opencv2
│   │   ├── # more directories
│   │   ├── core
│   │   │   ├── affine.hpp
│   │   │   ├── core.hpp
│   │   │   ├── core_c.h
│   │   │   ├── types_c.h
│   │   │   ├── version.hpp
│   │   │   └── wimage.hpp

maybe I'm not using the right clang parameters?

A bit of context: I want to analyse Opencv types, classes and functions, this info is present on the headers, so I don't think I would need the full library to read the code. When I tried to use the full library I found myself in trouble. I need to use the iOS compilation(?)version(?) of the library, hence I copy/pasted the headers from the compiled version into this working directory (sorry? :) )

EDIT 1: It may seem odd my directories having this opencv2/, but if I remove the headers from inside of it, clang will complain 'bout why aren't they there: fatal error: 'opencv2/core/types_c.h' file not found

Aucun commentaire:

Enregistrer un commentaire