symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

Autogenerated C++ includes nonexisting file type_t.hpp #397

Closed lgieron closed 2 months ago

lgieron commented 2 months ago
  1. I wrote a simple Python function doing computations on Symforce symbolic inputs.
  2. I generated the C++ code, following the tutorial:
    Codegen.function(iteration, config=CppConfig())
    codegen.generate_function("/mnt/d/Projects/3DReconstruction2019/c++/SymforceCppProj")
  3. I opened the generated iteration.h file in Visual Studio 2022 project, linked the gen/cpp folder in Symforce repo as an include path for the project.
  4. Upon compilation in VS, the following include in file gen/cpp/sym/ops/storage_ops.h fails:
    #include <lcmtypes/sym/type_t.hpp>

Upon inspection, I cannot find the missing file anywhere (neither in the repo, nor in the installed python package on my disc). Did I do something wrong? As far as I can see, there's nothing in the tutorial on how to compile the C++ code generated with Codegen .

My environment:

lgieron commented 2 months ago

I managed to find a solution. I compiled Symforce itself (from github repo) inside the Ubuntu machine, and then linked my autogenerated C++ code against the generated includes. After that, my autogenerated function compiled (with g++, so no more Windows/VS) without problems.