Best way to import public module folder using visual studio C++ 20

Viewed 570

There's a folder(D:\repos) contains a lot of module folders,mymath,mymath2 and myetc.

What's the best way to import mymath to my new project?

D:\repos\mymath\mymath.ixx:

export module mymath
import std.core;
namespace mymath{
  export void add() { std::cout << "mymath add called\n"; }
}
1 Answers

According to Mcicrosoft Blog, you could use the modules on disk according to the following steps.

External Modules

It is also possible to reference modules that exist on disk, instead of ones belonging to another project in the solution. Care needs to be taken here, however, because modules are compiled, binary files. You must make sure they are compatible with the way you are building your projects.

You can tell Visual Studio to look for modules on disk by editing the Additional Module Dependencies property:

enter image description here

Also, you could refer to this link for more information about module.

Related