Rant (sorry I'm angry not because of the modules thing): Ok so first of all someone please tell me why the ........ they can't make a simple module system that works like any other ........ing language and they have to make this complicated and stupid MESS???
Actual post: Ok so I have the following files:
Code:
// Filename: main.cc
export module main;
import second;
import third;
int main() {
second_fn();
return 0;
}
Code:
// Filename: second.cc
export module second;
import third;
export void second_fn() {
third_fn();
}
Code:
// Filename: third.cc
export module third;
import second;
#include <stdio.h>
export void third_fn() {
printf("A message!\n");
}
I have read a lot of post (including the official docs from the LLVM) but nothing worked for me. Let's say that I try to compile "main.cc". I can use something like the following command:
Code:
clang-12 -std=c++2a -fimplicit-modules -fimplicit-module-maps -c main.cc -Xclang -emit-module-interface -o main.pcm
But I will get the following error:
Code:
main.cc:3:8: fatal error: module 'second' not found
import second;
~~~~~~~^~~~~~
1 error generated.
Ok so the module "second" must first get created. So let's first compile this file using the same command but changing the filename. Then I get this error:
Code:
second.cc:3:8: fatal error: module 'third' not found
import third;
~~~~~~~^~~~~
1 error generated.
*STARTING TO GET ANGRY* Ok.... so let's first compile "third.cc".....
Code:
third.cc:3:8: fatal error: module 'second' not found
import second;
~~~~~~~^~~~~~
1 error generated.
*THROWS COMPUTER OF THE WINDOW*
I'm interested about GCC and Clang. Please help it's the only problem I'm having with C++ and I don't want to go on the D side because there are other problems here too....