I created a TestModule.ixx in one folder and I want to use import TestModule in my cpp project(in different folder).
I tried TestModule=E:\XXX\TestModule.ixx.ifc; in properties-> Additional Module Dependencies, but got error lnk2019.
Q: How to import module in other files? Is there a way like adding header file directory.
Module
export module TestModule;
#define ANSWER 42
namespace Example_NS
{
int f_internal() {
return ANSWER;
}
export int f() {
return f_internal();
}
}
Main:
import TestModule;
import std.core;
using namespace std;
int main()
{
cout << "The result of f() is " << Example_NS::f() << endl; // 42
system("pause");
}
Thanks in advance.