"Additional Module Dependencies" and "Additional BMI Directories" settings in Visual Studio

Viewed 739

Let's say I have two modules - Module1, Module2. Each module has its own project in Visual Studio. How to import Module2 into Module1 using the "Additional Module Dependencies" or "Additional BMI Directories" settings?

Issue: Visual Studio (2019/2022) cannot find any symbols from Module2.

Adding a reference to Module2 into Module1 does not help.

https://devblogs.microsoft.com/cppblog/a-tour-of-cpp-modules-in-visual-studio/ doesn't help much

3 Answers

Projects with modules can only be included when they have a configuration type equal to static library (lib). For other types such as dynamic library and executable you will need to set the Additional Module Dependencies. When a project compiles as a static library, the including project only needs to add a reference to your module project. When referencing a non lib project you will need to compile the module manually since the Build dependencies do not seem to handle this for you.

If everything seems correct but it does not work - check that you don't import the module in the precompiled header or vice versa.

Related