Why the modules in my project not working correctly?

Viewed 1153

My setup:

project-setup

I'm using Visual Studio 2019 and I'm new to modules in C++. This is the code in my module:

export module Module;
export void MyFunc();

And this is the code in the .cpp file

import Module;
myFunc()

But I keep getting the error:

E3344 module file mapping for 'Module' is invalid

How to resolve the error?

1 Answers

File mapping may be not correct because module.ixx which is the module interface file must be accompanied with module.cpp which is the module implementation file. (if you're separating implementation)

However keep in mind VS intellisense may not work as expected regardless with brand new C++20 language features.

This will take time until working properly, you can try with VS 2022 and set std:c++latest option to be up to date with intellisense.

Related