I've tried out this example code on Linux. My (modified) cpp code is here:
#include "Greeter-Swift.h"
void cPlusPlusCallsSwift() {
Greeter::printWelcomeMessage("Theo");
}
The command for generating headers is basically this command
My clang command:
!clang++ test.cpp -o test.o /path/to/swift/usr/lib/swift/linux/libswiftCore.so
And these are the errors:
/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/test-430dc9.o: in function `Greeter::printWelcomeMessage(swift::String const&)':
test.cpp:(.text._ZN7Greeter19printWelcomeMessageERKN5swift6StringE[_ZN7Greeter19printWelcomeMessageERKN5swift6StringE]+0x66): undefined reference to `$s7Greeter19printWelcomeMessageyySSF'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
What did I do wrong here? Are there any additional linker flags?