代码拉取完成,页面将自动刷新
PS F:\cst_proj\cpp20> xmake build
[ 0%]: generating.module.deps hh.a.cpp
[ 0%]: generating.module.deps hh.b.cpp
[ 0%]: generating.module.deps main.cpp
[ 0%]: generating.module.deps hh.a.ixx
[ 0%]: generating.module.deps hh.b.ixx
[ 0%]: generating.module.deps hh.ixx
[ 0%]: generating.module.deps hh.types.ixx
[ 8%]: compiling.module.release hh:types
// hh.ixx
export module hh;
export import :a;
export import :b;
// hh.types.ixx
export module hh:types;
export class A;
export class B;
// hh.a.ixx
#include <iostream>
export module hh:a;
import :types;
export class A {
private:
B* b = nullptr;
public:
static void say() {
std::cout << "A class" << std::endl;
}
int getInt() { return (int)'A'; }
int getInt2();
};
export void say() {
}
// hh.a.cpp
module hh:a;
import :b;
int A::getInt2() {
this->b = new B();
this->b->getInt();
return 100;
}
// hh.b.ixx
#include <memory>
export module hh:b;
import :types;
export class B {
private:
A* a = nullptr;
public:
int getInt();
};
// hh.b.cpp
#include <memory>
module hh:b;
import :a;
int B::getInt() {
this->a = new A();
this->a->getInt();
return 100;
}
// main.cpp
#include <iostream>
import hh;
int main(int argc, char* argv) {
std::cout << "ssss" << std::endl;
B b;
A a;
std::cout << b.getInt() << a.getInt() << std::endl;
return 0;
}
// xmake.lua
add_rules("mode.debug", "mode.release")
set_languages("c++20")
toolchain("clang17")
set_kind("standalone")
set_sdkdir("D:\\LLVM")
toolchain_end()
target("cpp20")
set_kind("binary")
add_files("*.cpp", "*.ixx")