Problem with "Getting Started" project

I tried to follow the "Getting Started with C++ Interop" guide, but I can't get past "error: public headers ("include") directory path for 'CxxTest' is invalid or not contained in the target".

Any idea what I'm missing?

module.modulemap:

module CxxTest {
  header "CxxTest.hpp"
  requires cplusplus
}

Folder structure and Package.swift:

Many thanks! :)

Can you try moving module.modulemap and CxxTest.hpp into a new subdirectory called include? (Sources/CxxTest/include)

Oh that works, thanks! I'm curious, what's the reason for that?

AFAIU an implicit include subdirectory is always required when building targets that contain module.modulemap with SwiftPM. We do need the "Getting Started" document for C++ to be updated to reflect that.

Ah interesting! I'm short on time, but quickly put together an issue on GH.

2 Likes