Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Is it wise to use C++ modules these days?
Qt 6.11 is out! See what's new in the release blog

Is it wise to use C++ modules these days?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 400 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Simmania
    wrote on last edited by
    #1

    Hi,
    I want to start a big project. I would like to create my code using C++ modules.
    I did search on 'C++ modules' in this forum but did not get a good impression if modules are well supported or not.

    So my question is: Is it wise to use C++ module for my project? Or will I stumble into problems that I need to solve? Would it be better to keep using .h interface files for the time being?

    1 Reply Last reply
    0
    • Nils SjobergN Offline
      Nils SjobergN Offline
      Nils Sjoberg
      wrote on last edited by
      #2

      Don't use C++ modules for a large Qt project in 2026 — moc doesn't support them yet

      "What's up, Doc?"

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonSchroeder
        wrote on last edited by
        #3

        C++ modules is still a mixed bag because the technology is not there, yet. Currently, only MSVC and CMake with the ninja generator can build programs that use modules. One of the major hurdles is that GCC (and clang?) needs several Build Module Files (BMI) depending on compiler flags. This is quite hard to manage, especially with 3rd party libraries. Additionally, you cannot easily mix e.g. std::vector or std::string from a header file and a module because they have different name mangling (there are certain tricks). So, especially for the std module you need to use it in all your library dependencies or not at all (or try the tricks around that).

        I guess modules could mostly just reduce compile times for external libraries that don't change. Basically, it gives kind of the same advantages in this area as precompiled headers (which also only work well for files that don't change). Within your own project you'll get too many dependencies that will linearize the build and thus parallel compilation might not work as well as before.

        BTW, there is a website where you can track which libraries support C++ modules: https://arewemodulesyet.org

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Simmania
          wrote on last edited by
          #4

          Thx!
          Guess it is better to start with plain .cpp and .h file for now.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved