Skip to main content

Section 12.15 Final Program Using Modules

Here is the final program using the DateFunctions module. It requires the DateFunctions module to build. It can be compiled with the following command:
$ g++ -std=c++20 -fmodules-ts main.cpp DateFunctions.cxx -o program.exe
Listing 12.15.1. main.cpp for use with module
And the final unit test program. It can be compiled with the following command:
$ g++ -std=c++20 -fmodules-ts dateTests.cpp DateFunctions.cxx -o test-program.exe
Listing 12.15.2. dateTests.cpp for use with module
Add the code for the module itself. It can not be linked into a full program, but can be compiled. It would be compiled with something like:
g++ -c -std=c++20 -fmodules-ts DateFunctions.cxx -o DateFunctions.o
Listing 12.15.3. DateFunctions.cxx
You have attempted of activities on this page.