Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gcc example:
- ```
- import <iostream>;
- int main()
- {
- std::cout << "Hello modules!\n";
- return 0;
- }
- ```
- https://i.imgur.com/Y0gR8p7.png
- g++ -std=c++20 -fmodules-ts -x c++-system-header iostream
- g++ -std=c++20 -fmodules-ts main.cpp -o hello
- clang++ -std=c++20 -stdlib=libc++ -fmodules -fbuiltin-module-map main.cpp -o hello
- Here steps with MSVC:
- 1. Install 16.10 Preview 2
- 2. enter some code with header units.
- My example:
- ```
- import <iostream>;
- import <vector>;
- int main()
- {
- std::vector v{1,2,3};
- std::cout << "Hello modules!\n";
- return static_cast<int>(v.size());
- }
- ```
- 3. Open command promt for Visual Studio 2019 Preview.
- 4. Compile header units which you use.
- for iostream:
- cl /EHsc /nologo /W4 /std:c++latest /MD /exportHeader /headerName:angle iostream /Fo:iostream.obj
- for vector:
- cl /EHsc /nologo /W4 /std:c++latest /MD /exportHeader /headerName:angle vector /Fo:vector.obj
- 5. Compile example:
- cl /EHsc /nologo /W4 /std:c++latest /MD /headerUnit:angle "iostream=iostream.ifc" /headerUnit:angle "vector=vector.ifc" main.cpp iostream.obj vector.obj
- main.cpp
- Real screenshot:
- https://i.imgur.com/WElKYjo.png
Add Comment
Please, Sign In to add comment