Hello all!
Writing own example of using Swift/CPP interoperability. Got stacked with this error when building it:
[1/2 3.8/sec] Building CXX object CMakeFiles/UsingSwiftCPPInterop_v1.dir/main.cpp.o
[2/2 3.0/sec] Linking Swift executable UsingSwiftCPPInterop_v1
FAILED: UsingSwiftCPPInterop_v1 CMakeFiles/UsingSwiftCPPInterop_v1.dir/Swift/atestmodule.swift.o
duplicate symbol '_main' in:
../CMakeFiles/UsingSwiftCPPInterop_v1.dir/main.cpp.o
../CMakeFiles/UsingSwiftCPPInterop_v1.dir/Swift/atestmodule.swift.o
ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
What is missing by me? The code of CMake project published here
My build envieionment:
CMake 3.29.3
MacOS 14.7.1
In this project Swift files linked directly to project/target. Should it be separated to library target o there must be some parameters that is telling clang to compile it without main?
Topic:
Developer Tools & Services
SubTopic:
General