How to provide absolute path of include directories in code generation?

30 views (last 30 days)
I want to include some files which is not in the current working directory. Is it possible to provide absolute path in include directory in Custom Code in Code Generation pane. Please mention the syntax to provide the absolute path.

Accepted Answer

Jason Moore
Jason Moore on 6 Feb 2015
It is possible to include files using a relative or absolute paths. The syntax for relative paths is shown in the following link Relative Custom Code Include Path
To include a absolute path for include files with embedded coder you can simply goto Configuration Parameters -> Code Generation -> Custom Code -> Include Directories and then type in your folder paths i.e. C:\My_Folder\
  3 Comments
Jason Moore
Jason Moore on 9 Feb 2015
Can you include a list of items in your Custom Code pane and the error that is thrown during linking?
Phil Taylor
Phil Taylor on 23 Feb 2016
I've got the exact same problem using Include Directories in Embedded Coder. There appears to be a bug where the relative folder gets added to the current folder instead of the relative adjustment occurring. For example, I get combinations of errors like this:
Working Directory
"C:\somedir\codegendir"
Source File
included.c
Include directory of source file (relative)
..\..\includedir
Error (this is paraphrased from various errors)
The following error occurred while tokenizing the custom code parameters:
'included.c specified in custom source files string does not exist in any
of the following search directories:
"..\..\..\includedir"
"C:\somedir\codegendir"
"C:\somedir\codegendir\..\..\includedir"
What it should do is find this folder relative to codegendir:
"C:\includedir"

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!