Results 1 to 2 of 2

Thread: Can not use the modules feature from c++20 with Qt Creator and VS

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Oct 2024
    Posts
    6
    Qt products
    Platforms
    Windows
    Thanked 1 Time in 1 Post

    Default Re: Can not use the modules feature from c++20 with Qt Creator and VS

    You can try this code

    cmake_minimum_required(VERSION 3.20) # Ensure proper support for C++20 modules

    project(Source LANGUAGES CXX)

    # Set C++20 standard
    set(CMAKE_CXX_STANDARD 20)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)

    # Add executable and module files
    add_executable(Source main.cpp AirlineTicket.cppm AirlineTicket.cpp)

    # Enable C++20 features and experimental module support
    target_compile_features(Source PRIVATE cxx_std_20)
    target_compile_options(Source PRIVATE /experimental:module)

    # Mark AirlineTicket.cppm as a C++ source file
    set_source_files_properties(AirlineTicket.cppm PROPERTIES LANGUAGE CXX)

    # Add installation rules (optional)
    include(GNUInstallDirs)
    install(TARGETS Source
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    )

  2. The following user says thank you to OmarDay for this useful post:

    d_stranz (19th December 2024)

Similar Threads

  1. qt-creator on Raspberry Pi 2 (Unknown modules; designer)
    By pirata in forum Installation and Deployment
    Replies: 2
    Last Post: 24th October 2015, 17:14
  2. Replies: 0
    Last Post: 5th September 2015, 00:22
  3. Qt Creator/MingGW on Windows - Problems with XML, OpenGL, etc. modules
    By craigdillabaugh in forum Installation and Deployment
    Replies: 0
    Last Post: 12th January 2011, 17:29
  4. Qt modules on Win
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 25th July 2010, 12:24
  5. Qt modules
    By ber_44 in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2007, 22:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.