# \#include "user\_defined\_header.h" not accessible at compilation

**URL:** <https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333>\
**Category:** General\
**Tags:** c2000\
**Created:** [October 6, 2026, 12:53pm UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333 "2026-10-06T12:53:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blaise](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@Blaise](https://forum.plexim.com/u/Blaise)\
**Post date:** [October 6, 2026, 12:53pm UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333/1 "2026-10-06T12:53:01Z")

</div>

Dear all,

I work with coder and will keep the structure of my team.

I’ve added a header file containing some struct only to facilitate decoding of structured register (word and bit level), used by both “state machine block” and “C-Scripts block”.

The structure of my project is:

ProjectRoot/  
│  
├── My\_PLECS\_model.plecs  
│ My\_user\_defines.h  
└── codegen/

In my model, e.g for state machine, the #include _“My\_user\_defines.h”_ in C declaration works fine, I can build my state machine without errors, but at compilation it does not works, as the path from codegen is different!

* * *

As workaround, I modified my structure as following:

ProjectRootAlternative/  
│  
├── model/My\_PLECS\_model.plecs  
│ include/My\_user\_defines.h  
└── codegen/

and modified my include in C declaration of state machine as follow:  
#include _“../include/My\_user\_defines.h”_. In this case, this works correctly when editing the plecs template as well as during compilation, due to same relative path from both location model and codegen.

* * *

Is there a way to works without project structure modification (the first project structure)? Is there a solution to add search user files path relative?

Thanks for any suggestion.

Best regards.

Blaise

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [October 9, 2026, 12:19am UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333/2 "2026-10-09T00:19:52Z")

</div>

Blaise, what target are you using? Can you also share the version of PLECS and the TSP version you are using as well?

When I try to compile with your original arrangement everything works fine. See the attached example which I tested with the most recent public versions of the TI C2000 and STM32 targets. I set the output directory to a non-default folder titled “codegen”. The header and C files are automatically copied into that folder.

The example is attached below, from [C-Scripts — PLECS 5.0 Documentation](https://docs.plexim.com/plecs/latest/c-scripts/#load-external-files)

[cscript\_example\_external\_files.zip](https://forum.plexim.com/uploads/short-url/5DCuw3rpwL5ktkcrSSECw8FF0hx.zip) (8.1 KB)

---

<div class="post-metadata">

**Author:** ![Blaise](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@Blaise](https://forum.plexim.com/u/Blaise)\
**Post date:** [October 19, 2026, 2:13pm UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333/3 "2026-10-19T14:13:32Z")

</div>

Dear Bryan,

I currently use PLECS 5.0.6. I use PLECS C2000 TSP V2.3.3 (PLECS C2000 TSP/cgt/ti-cgt-c2000\_22.6.1.LTS).

In my case, I want to declare one local variable in C-Script. In this case it does’nt work (I can simulate my modell without error, but I can not generate code).

I want submit my exemple in my answer, but I could not send a zip file. How do I have to proceed?

Best regards.

Blaise

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [October 20, 2026, 1:42am UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333/4 "2026-10-20T01:42:46Z")

</div>

For security reasons \*.zip files are disallowed for general users. You can post a \*.plecs model and your \*.c and \*.h files, along with a description of your folder structure in the body of the post.

---

<div class="post-metadata">

**Author:** ![Blaise](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@Blaise](https://forum.plexim.com/u/Blaise)\
**Post date:** [October 20, 2026, 6:20am UTC](https://forum.plexim.com/t/include-user-defined-header-h-not-accessible-at-compilation/3333/5 "2026-10-20T06:20:05Z")

</div>

To completeI my post from yesterday, I send now my two files that are in ProjectRoot (only _.plecs and .h file, as I don’t need a_ .c file). The output directory is named codegen

The awaited structure of my project is:

ProjectRoot/  
│  
├── RegisterBitOrganisationFail.plecs  
├── RegisterMapFail.h  
└── codegen/

* * *

Here the screenshoot of general tab too:

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/7/7b68c461bbdc7d1ccd2a1f25020f0544eb592ff5.png)

* * *

I can start a simulation without error, but I can not build the project. Here an extract of Diagnostics tab:

_Error in build step #4 (Make): Make process exited with code 2:  
“C:/Program Files/Plexim/PLECS 5.0 (64 bit)/make/make” -f RegisterBitOrganisationFail.mk ./output\_TI2837x\_cpu1/RegisterBitOrganisationFail.elf_

…

"_RegisterBitOrganisationFail\_0.c", line 11: fatal error: cannot open source file “RegisterMapFail.h”  
1 catastrophic error detected in the compilation of “RegisterBitOrganisationFail\_0.c”.  
Compilation terminated.  
make[1]: \*\*\* [output\_TI2837x\_cpu1/RegisterBitOrganisationFail\_0.obj] Error 1  
make: \*\*\* [all] Error 2_

* * *

Hope you can reproduce error with same structure.

Best regards.

Blaise

* * *

[RegisterBitOrganisationFail.plecs](https://forum.plexim.com/uploads/short-url/aL7nOOF9YJotAavoSsepl3Glkmp.plecs) (12.5 KB)

[RegisterMapFail.h](https://forum.plexim.com/uploads/short-url/ghdH2lgoVWCCx4eKHXcXHjfxCAw.h) (419 Bytes)
