How to import module to module?

D.D.K-2637 966 Reputation points
2021-02-16T21:51:34.297+00:00

Hi,
I have set up my project on vs2019 / v142-16.8.5 with the following properties:

  • Language: Latest C++
  • Enable modules: Yes (/ experimental: module)
  • /EHsc /MD
  • build tool: C++ Modules for v142 build tools.

The problem I am having is:
I have 2 folders: Point and Arc
For each folder I have added 2 files: AUArc_extension.ixx and AUPoint_extension.ixx
However I cannot import the Point module into Arc module, here is the code in Point module :

//AUPoint_extension.ixx  
  
 #pragma once  
 module;  
 #include <vector>  
 #include <string>  
 #include "Modules.h"  

 export module AUPoint_extension;  
  
export namespace AUPoint {  
    export  
  int fpoint_select(PT3D& basept, const ACHAR* prompt, PT3D& nextpt);  
    export  
  int fpoint_select(const ACHAR* prompt, PT3D& nextpt);  
    ...  
  
}  
  
int AUPoint::fpoint_select(PT3D& basept, const ACHAR* prompt, PT3D& nextpt)  
{  
    ...  
}  
  
int AUPoint::fpoint_select(const ACHAR* prompt, PT3D& nextpt)  
{  
   ...  
}  

this error I get from Arc module (AUArc_extension.ixx).

68746-image.png

Both files are compiled as modules, not sure what am I missing?

Update: I have read this post but it still doesn't work, do I need to compile separate modules and separate solution? but how to do it?

Thank you.

Developer technologies C++
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2021-02-17T03:29:42.28+00:00

    @D.D.K-2637

    As far as I'm concerned, C++ 20 Modules support has not been implemented yet. And you could try to compile separate modules and separate solution. I suggest you refer to the following thread, which seems to be similar to your issue: https://developercommunity.visualstudio.com/content/problem/882097/c-modules-unable-to-import-module-that-has-child-m.html

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.