fprime
fprime copied to clipboard
If cpp files depend on fpp but are listed in reverse order, compile fails
| F´ Version | 3.4.0 |
| Affected Component | fprime-util |
Problem Description
This order is required if the cpp file(s) depend on class(es) that fpp generates.
set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FrameHeaderSerializable.fpp" "${CMAKE_CURRENT_LIST_DIR}/MyComponent.fpp" "${CMAKE_CURRENT_LIST_DIR}/MyComponent.cpp" "${CMAKE_CURRENT_LIST_DIR}/MyComponent.hpp" )
How to Reproduce
Expected Behavior
The build system should auto-code what is required first.
To work around, sort your SOURCE_FILES list with any autocoder model file listed first.
@kbotteon would you add context? I just changed the source file order and got a successful build. Thus I need more detail to reproduce.
It's been a minute, so I don't quite remember, but you and I were debugging this in 301. I think if you #include a header that is auto-coded in your CPP, like a type that is defined in an FPP, and that FPP is listed after the CPP in CMakeLists, the first build will fail on the CPP as the tools haven't yet gotten around to generating the required header. Or maybe add a type in an existing Component FPP (to auto-code a CompName_StructName), ensure the CPP implementation is before the FPP in CMakeLists, and see what happens on build. If that's working now, I think you can close this.
I have tried the following to reproduce with the .cpp file first in the source list:
- Import component
Ac.hppdirectly in component.cpp: No error - Import type
Ac.hppin component.cpp: No error - Item 2, but with a separate
.fppfile: No error - Adding type inside component and importing as above: No error.
I hate to say it, but I am unable to reproduce this error. We can open this back up if it happens again and try pin it down.