Posts

Post marked as solved
2 Replies
1.3k Views
I'm trying to include a C++ Swift Package into an iOS app.I'm completely new to xcode and I'm having a lot of trouble making my project build.My code relies on c++14 features, and I depend on pthreads, security framework and some static libraries that I have already built (openssl).This is my Package.swift:// swift-tools-version:5.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyLibrary", products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "MyLibrary", targets: ["MyLibrary"]), ], dependencies: [], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "MyLibrary", dependencies: [], path: "Sources/MyLibrary", cxxSettings: [ .headerSearchPath("Dependencies/include/") ], linkerSettings: [ .linkedFramework("Security"), .linkedLibrary("pthread"), .linkedLibrary("/Users/matteo/Documents/Workspace/C++/MyLibrary/Sources/MyLibrary/Dependencies/lib/libcrypto.a"), .linkedLibrary("/Users/matteo/Documents/Workspace/C++/MyLibrary/Sources/MyLibrary/Dependencies/lib/libssl.a"), ]), ], cxxLanguageStandard: CXXLanguageStandard.cxx14 )The real problem begins when I try to build it.I get hundreds of error like:In file included from /Users/matteo/Documents/Workspace/C++/MyLibrary/Sources/MyLibrary/utils/SessionService.cpp:6: In file included from /Users/matteo/Documents/Workspace/C++/MyLibrary/Sources/MyLibrary/include/protocol/utils/HttpClient.h:9: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:480: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:73:35: error: expected ';' at end of declaration __tree_is_left_child(_NodePtr __x) _NOEXCEPT ^ error: C++ requires a type specifier for all declarations __tree_is_left_child(_NodePtr __x) _NOEXCEPT ^ note: expanded from macro '_NOEXCEPT' # define _NOEXCEPT noexcept ^orIn file included from /Users/matteo/Documents/Workspace/C++/MyLibrary/Sources/MyLibrary/protocol/data/LPrefixedString.cpp:8: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/codecvt:59: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__locale:18: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/mutex:191: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:15: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/chrono:932:67: error: expected ';' at end of declaration list _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() _NOEXCEPT {return _Rep(0);}I have no idea the reason and if I messed up anything in the Package.swiftI followed the documentation at Target - Swift Package Manager | Apple Developer DocumentationThanks
Posted Last updated
.