Wpis z mikrobloga

@RedveKoronny: no to masz dwa pliki helloworld.cpp i main.cpp wiesz musisz oba skompilowac i zlinkowac w jednym kroku poprzez clang++ -fmodules -std=c++20 helloworld.cpp main.cpp -omojprogram
albo osobno skompilowac kazdy z nich

clang++ -c -fmodules -std=c++20 helloworld.cpp
clang++ -c -fmodules -std=c++20 main.cpp
i zlinkowac

clang++ -fmodules -std=c++20 helloworld.o main.o -omojprogram
@RedveKoronny:
Now, let’s compile it. There are two steps in compiling this program:
Compile the module into .pcm , which stands for Pre-compiled Module
Compile main.cpp with the .pcm file
In Clang 10, we have to specify the flag -std=c++2a with other flags. Refer to the Clang Modules page for detailed explanation.
$ clang++ -std=c++2a -c helloworld.cpp -Xclang -emit-module-interface -o helloworld.pcm
$ clang++ -std=c++2a -stdlib=libc++ -fprebuilt-module-path=. main.cpp helloworld.cpp
Run the compiled
u mnie zadzialalo to

$ clang++ -std=c++2a -stdlib=libc++ -fimplicit-modules -fimplicit-module-maps -c helloworld.cpp -Xclang -emit-module-interface -o helloworld.pcm
$ clang++ -std=c++2a -stdlib=libc++ -fimplicit-modules -fimplicit-module-maps -fprebuilt-module-path=. main.cpp helloworld.cpp
$ ./a.out
Hello Module! Data is 123
@RedveKoronny:

[nix-shell:/tmp/cppmodules]$ clang++ -std=c++2a -stdlib=libc++ -fimplicit-modules -fimplicit-module-maps -c helloworld.cpp -Xclang -emit-module-interface -o helloworld.pcm
clang-11: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]

[nix-shell:/tmp/cppmodules]$ l
total 72K
drwxr-xr-x 2 user users 4.0K Apr 21 15:48 .
drwxrwxrwt 33 root root 4.0K Apr 21 15:47 ..
-rw-r--r-- 1 user users 188 Apr 21 15:42 helloworld.cpp
-rw-r--r-- 1 user users 54K Apr 21 15:48 helloworld.pcm
-rw-r--r-- 1 user users 74 Apr 21 15:42 main.cpp

[nix-shell:/tmp/cppmodules]$