Clear Filters
Clear Filters

How to set define a header files directory for the MinGw64 compiler

6 views (last 30 days)
I have the following problem when compiling C++ code with mex:
As my source code was developed for another platform, the use of the header files is declared with something like: "#include "emb_syst/controller/functions/control_1.hpp"
In order to be able to comile i have to change every single file and define the complete route in my harddrive with something like this: "#include "c:\source_files\emb_syst\controller\functions\control_1.hpp"
This is very annoying since i have to change all the files. Is there a way to tell the compiler on which directory all the header files are (in my case the compiler should search for the header files recursevely in the directory: "c:\source_files\"

Answers (1)

Abhi Sundararaman
Abhi Sundararaman on 12 Oct 2017
Rather than changing the C++ code to have the path to the header, you can call "mex" with the "-Ipathname" flag to specify the path to the include directory files. An example of this can be found in the documentation below:

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!