Yes, VS 2022 does support internal partition files, the file's compilation type has to be manually modified in the settings.
Make sure your project is using C++ standard C++20 or latest. Duh.
VS 2022 defaults file compilation to "
Compile as C++ module code (/interface)". Right click the file you want to change in solution explorer, C/C++, Advanced, Compile As. Change to "
Compile as C++ Internal Partition (/internalPartition)".
See an example:
https://github.com/Apress/beginning-cpp20/tree/main/Examples/Modules/Chapter%2011/Ex11_05
M'ok. 6 files.
Ex11_05.cpp - default compilation
from_roman.cpp - modify to internal partition
roman.cppm - default compilation
roman-from.cppm - default
roman-internals.cpp - modify to internal
roman-to.cppm - default
Consider buying the Horton/Van Weert book "Beginning C++20: From Novice to Professional".
https://link.springer.com/book/10.1007/978-1-4842-5884-2
There's also a follow up book by the authors, "Beginning ++23: From Beginner to Pro".
https://link.springer.com/book/10.1007/978-1-4842-9343-0
I have both. Worth the price IMO to have both. I would recommend getting the eBook edition, the printed books are very lightweight and flimsy paperbacks.
Lots of good explanation of each standard. Also included is info about the differences between header and module files available in an appendix. The C++20 book appendix is available at the Apress GitHub repo, C++23 includes the appendix in the book's text.
FYI, apparently the latest patch update for VS 2022 now has the C++20 standard flag as part of the settings available. Obviously using C++23 features requires C++ standard as latest.
I modified the default settings in VS 2022 so every new project/solution I create uses C++ standard latest as the default. I modified the general setup by reading this thread:
https://cplusplus.com/forum/lounge/271176/
I learned the ins and outs of modules from reading the books, scouring the bowels of the internet and creating/testing lots and lots of other example code. Trial and error.
On my own.
I periodically reread the books and compile the example and exercise code snippets. And mash up more test code. To refresh my memory and understanding of the features.
One thing requires being emphasized. Modules are
NOT header files. Though they do similar things they are treated differently by the compiler. There are no implicit imports with modules. With headers you can chain up the includes by having #includes in another header. That doesn't work with modules. Ever.
Tattoo that on the inside of your eyelids.