Post

Replies

Boosts

Views

Activity

Reply to Add a C++ function that can be used by multiple XCTest files in Xcode
This works. There is a question at the end. I added a Utilities.hpp file in my XCTest folder, "TestsOrangeSpider" (separate from my project code.) #ifndef Utilities_hpp #define Utilities_hpp #import <XCTest/XCTest.h> void testGLMVEC3(const glm::vec3& actual, const glm::vec3& expected); #endif In the same folder I have a Utilities.cpp file. #include "Utilities.cpp" void testGLMVEC3(const glm::vec3& actual, const glm::vec3& expected) { XCTAssertEqualWithAccuracy(actual.x, expected.x, 0.00001f);... } In one of my test files I import the .cpp file. In all other test files I import the .hpp file. Importing the .cpp file in all test files doesn't work. Importing the .hpp file in all test files doesn't work. It has to be one file imports the .cpp and all other files import the .hpp. Why is there this odd combination requirement? Thanks : )
Oct ’25