Hi!
I must be missing something. I am creating a MacOS dynamic library using Xcode. I have created the library as follows:
File->New Project then choose macOS 'Library' in Frameworks and Libraries.
I give the Product Name "TestLib".
Framework: STL (C++ Library)
Type: Dynamic
This creates a default library project, with one exported class 'TestLib'. There's a method "HelloWorld". And this suffices for my issue.
To be able to test my dynamic library, I want to use an XCtest target.
So in the project settings, I select '+', and add a 'Unit Testing Bundle':
Product name: TestLibTests
Language: Swift
Testing System: XCTest
Project: TestLib
Target to be tested: TestLib
I press finish, and my test target is created.
Now, I think I need to have a module map. So I Add New File From Template', and choose 'Module Map'. A 'module.modulemap' is created. In the module map file, I name the module 'TestLib', and header 'TestLib.h'.
So far, everything makes sense, and no errors. But here it comes...
When I want to make a testcase, I need to import the module. I first built the dylib library, to make sure it's built without errors and exists.
Then I switch to the TestLibTests target and want to write my first test. Simply creating an object from the TestLib class. For that, I have to import the module, so I write 'import TestLib' after the 'import XCTest' at the top.
And here is where I'm stuck. No matter what I do, Xcode just gives me the error 'No such module TestLib'.
This should just work, right? I should be able to unit test my library. I have spent 2 days reading the internet and trying many suggestions, but I just can't get it to work.
I am currently working with Xcode 26 beta. But I tried with Xcode 16.4 and that has the same issue.
What am I missing?