Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete type 'gtsam::HybridGaussianFactorGraph' #1382

Closed
varunagrawal opened this issue Jan 11, 2023 · 7 comments
Closed

Incomplete type 'gtsam::HybridGaussianFactorGraph' #1382

varunagrawal opened this issue Jan 11, 2023 · 7 comments
Assignees
Labels
bug Bug report

Comments

@varunagrawal
Copy link
Collaborator

Description

Compiling a project that uses GTSAM's new hybrid module throws an error

../../../include/gtsam/hybrid/HybridNonlinearFactorGraph.h:71:3: error: incomplete type 'gtsam::HybridGaussianFactorGraph' named in nested name specifier
  HybridGaussianFactorGraph::shared_ptr linearize(
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../include/gtsam/hybrid/HybridNonlinearFactorGraph.h:25:7: note: forward declaration of 'gtsam::HybridGaussianFactorGraph'
class HybridGaussianFactorGraph;

This error only happens when compiling a project that depends on GTSAM.

The RCA is that the #include for HybridGaussianFactorGraph was removed and replaced with a forward declaration. The forward declaration works within the GTSAM framework but errors out once we go to an external project.

Tagging @dellaert for his information.

Steps to reproduce

  1. Create a project with a script that uses the HybridNonlinearFactorGraph.
  2. Compile it with CMake.

Expected behavior

External project should compile cleanly.

Environment

Additional information

@varunagrawal varunagrawal added the bug Bug report label Jan 11, 2023
@varunagrawal varunagrawal linked a pull request Jan 11, 2023 that will close this issue
@varunagrawal varunagrawal mentioned this issue Jan 11, 2023
@varunagrawal
Copy link
Collaborator Author

Fix is to include in the .h file (even though the usage is only in the .cpp file).

@dellaert
Copy link
Member

I can add it in next PR

@dellaert
Copy link
Member

Fix is to include in the .h file (even though the usage is only in the .cpp file).

@varunagrawal maybe I misunderstood: you mean the .h file in your project, and hence it is not a GTSAM issue? In that case I'll close again.

@varunagrawal
Copy link
Collaborator Author

@dellaert I added the comment in #1383

@varunagrawal
Copy link
Collaborator Author

@dellaert I am rethinking this issue and I find it odd that a user needs to include HybridGaussianFactorGraph.h even when they don't use it. Moreover, this is easy to break since in routine code cleanup, someone may delete that header and then get this weird issue. Thoughts?

@dellaert
Copy link
Member

What happens if you don’t use ::shared_ptr, but use boost::shared_ptr instead?

@varunagrawal
Copy link
Collaborator Author

That works! Adding it to #1387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants