Hi,
I am trying to use the modules feature (since C++20) but the compiler does not recognize it. I tried with VS2019 and VS2022 as compilers but the result is the same.

Below the content of my CMakeLists script:
Qt Code:
  1. cmake_minimum_required(VERSION 3.5)
  2.  
  3. project(Source LANGUAGES CXX)
  4.  
  5. set(CMAKE_CXX_STANDARD 20)
  6. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  7.  
  8. add_executable(Source main.cpp
  9. AirlineTicket.cppm
  10. AirlineTicket.cpp)
  11.  
  12. target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
  13.  
  14. include(GNUInstallDirs)
  15. install(TARGETS Source
  16. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  17. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  18. )
To copy to clipboard, switch view to plain text mode 

And a very simple example of module:
Qt Code:
  1. export module airline_ticket;
  2.  
  3. import <string>;
  4.  
  5. export class AirlineTicket
  6. {
  7. public:
  8. AirlineTicket();
  9. ~AirlineTicket();
  10.  
  11. double calculatePriceInDollars();
  12.  
  13. std::string getPassengerName();
  14. void setPassengerName(std::string name);
  15.  
  16. int getNumberOfMiles();
  17. void setNumberOfMiles(int miles);
  18.  
  19. bool getHasEliteSuperRewardsStatus();
  20. void setHasEliteSuperRewardsStatus(bool status);
  21.  
  22. private:
  23. std::string m_passengerName;
  24. int m_numberOfMiles;
  25. bool m_hasEliteSuperRewardsStatus;
  26. std::string m_passengerName{ "Unknown Passenger" };
  27. int m_numberOfMiles{ 0 };
  28. bool m_hasEliteSuperRewardsStatus{ false };
  29. };
To copy to clipboard, switch view to plain text mode 

When I try to build the project, the compiler does not recognize absolutely anything about the module.
I import the module in AirlineTicket.cpp with the following code:
Qt Code:
  1. module airline_ticket;
  2.  
  3. using namespace std;
  4. ...more code...
To copy to clipboard, switch view to plain text mode 

Is there anything specific I have to do to write C++20 code?
Thanx