Okapi V4 .hpp files

I’m trying to put this in a .hpp file to use else ware in my code.
The type my linter gave me is. std::shared_ptr<okapi::ChassisController>

auto chassis = ChassisControllerBuilder()
  .withMotors(10, -9)
  .withDimensions({{4_in, 10_in}, imev5GreenTPR})

What is the question?
Was something like this working in OkapiLib 3xx?
Do you know you are defining chassis in the HPP and not declaring it? BTW, auto require defining but defining is not usually done in header files.

This is in a .cpp file. Yes something very similar worked in okapi V3.
I’ve tried different variations of these extern std::shared_ptr chassis; extern auto chassis;

I have this type of usage working for Okapi V3. You can see what i did here:

I had to explicitly declare the type in the header file (robot.h) so it could be referenced in any file with the include.
extern std::shared_ptr<okapi::ChassisControllerIntegrated> chassis;
(Note that I did not do a good job of keeping my header files limited to only where they were needed. I put everything in main.h , I plan to clean that up one day.)

The definition is in opcontrol but can be used in the auton files.

std::shared_ptr<okapi::ChassisControllerIntegrated> chassis =

You only need the type of structure (in my example) if you use multiple files that want access to chassis. If you only have one file, then I’m not sure the issue.

BTW, I plan on migrating my example code to v4 soon , maybe this weekend.


I forgot to say there is another way by putting the chassis definition in its own class. Then the class can be used as expected (declared in the header and defined in a CPP).