6

i have been spending another 3 days trying to get xcode 11 to work with c++20 modules. no luck.

clang on my machine (latest versions of xcode, clang, mac os) however is perfectly capable of handling modules thru a makefile. but IDE support seems to be zilch, i cant get xcode to recognize and parse (no less compile) any module file (whatever extension i give this, wherever i put it, associate it with, etc).

a year ago i also hit my head against the wall.

c++20 modules. can I use them "today" with Xcode 11?

c++20 modules (experimenting with Xcode 11)

incidentally i also had no luck with IDE support for modules with clion and vscode... im flabbergasted that c++20 modules seem to take so long to get support, at least for the modules you write yourself, not the standard library etc stuff - for me, that can wait as it may be more complicated to implement and is not so closely related to the well-organizedness and "modular" design of your own code and projects...

anyway, my questions:

  1. can YOU get modules to work (ie. module files automatically be identified compiled, exported and imported) in xcode 11 or any other IDE?
  2. will xcode 12 offer (more) support?

thx

edit: just to justify my obsession with this matter, i just read stroustrup a tour of c++ 2ed: (my bold)

The differences between headers and modules are not just syntactic.

  • A module is compiled once only (rather than in each translation unit in which it is used).
  • Two modules can be imported in either order without changing their meaning.
  • If you import something into a module, users of your module do not implicitly gain access to (and are not bothered by) what you imported: import is not transitive.

The effects on maintainability and compile-time performance can be spectacular.

mrchance
  • 1,133
  • 8
  • 24
  • 1
    C++20 isn't even out yet. :) No compiler yet fully supports all of C++20 and no compiler yet fully supports modules, much less any IDEs. See https://en.cppreference.com/w/cpp/compiler_support for which compilers support what, and expect IDE support to trail compiler support. – Sean Middleditch Jul 07 '20 at 21:29
  • 2
    @SeanMiddleditch ok thx, i'll just have to wait. just strikes me as very odd that no IDE has yet chosen to include minimal support, ie for self made modules, being able to provide encapsulation and avoidance of header files for your own data/functions/objects. that of course must be due to lack of demand. so i guess my _level_of_ bewilderment is directed at this lack of demand, given 1) the extreme usefulness of even rudimentary module support, 2) many compilers incl. clang already provide rudimentary support, 3) how many million c++ programmers??? thx – mrchance Jul 08 '20 at 11:49
  • btw also tried (intensively) with xcode 12 beta 1, no luck whatsoever – mrchance Jul 09 '20 at 12:07
  • https://stackoverflow.com/questions/63688639/c20-library-support-for-xcode-12/63690216?noredirect=1#comment112626458_63690216 – puio Sep 17 '20 at 20:55
  • Try it in 2023. At least 2 more years (maybe 2025 is a more realistic) before tools are ready for C++20. Don't be fooled by web frameworks about thinking that new technology gets into systems fast. It doesn't. 5 years is just like tomorrow. – Lothar Apr 25 '21 at 15:18

0 Answers0