Why do some classes of a library need to be included and not others?

Viewed 223

Starting Point

I have a C++ application (working with VS2019, Window 10 64bit), which heavily relies on the Open3D library. Everything was working perfectly fine, I was using the previous version (0.14.x), which I built from source using CMAKE and Visual Studio 2019.

There are some features in the new version (0.15.1) I would like to use. Furthermore, new releases come with a binary packages, so no more building from source. So I backup my current version and download the new binaries and try to link them to my project.

Issue

To start from a clean slate I remove all the old entries for Open3D and manually insert the new ones. Here are the entries:

Project Properties --> C/C++ --> General --> Additional Include Directories:

  • C:\Open3D\include
  • C:\Open3D\include\open3d\3rdparty
  • other stuff

Project Properties --> Linker --> Input --> Additional Dependencies:

  • C:\Open3D\lib\Open3D.lib
  • other stuff

Building now leads to a whole lot of linker errors all connected to fmt, a 3rd party library used by Open3D it seems. However, these seem to be caused only because, I have two additional includes with respect to Open3D in my precompiled header:

// open3d
#include "open3d/Open3D.h"
#include "open3d/core/Indexer.h"
#include "open3d/t/geometry/RaycastingScene.h"

If I remove them, all linking errors disappear, but I'm facing yet another issue: Indexer.h is needed for the TensorIterator class, RaycastingScene.h for the RaycastingScene class, both of which I'm using a lot in my project.

Question(s)

Why do I need an extra import for RaycastingScene but not for example VoxelblockGrid, which is in the same namespace? I have already tried to clone, build and link fmt manually. It looks like I can access the library from my own code successfully, but using Open3D I still get the same linker errors. How am I supposed to use these two classes?

0 Answers
Related