Search code examples
c++swigdistutils

Accessing header files in a large C++ project by <...>


I have a project with two packages:

Project

|-- Package_A
  |-- exA.cpp
  |-- exA.h
|-- Package_B
  |-- exB.cpp
  |-- exB.h

In this project say, exB.cpp references to exA.h as

#include <Package_A/exA.h>

However, I want to use SWIG to create a Python interface for this file using distutils. I include following code in Extension definition:

sources=["Package_A/exA.cpp", "Package_B/exB.cpp"]
include_dirs=["Package_A/exA.h", "Package_B/exB.h"]

I have an error in compilation about header references. I can suspend that error if I use:

#include "../Package_A/exA.h"

There are many files like this. How I can I enable referencing with<...>?


Solution

  • For compiler <...> means search for include in defined include paths. Simply define include path when compiling. Similar problem already answered: How to include header files in GCC search path?