[swift-users] Using Swift Package Manager with C++

Daniel Dunbar daniel_dunbar at apple.com
Sat Nov 12 15:44:29 CST 2016


This was just fixed on trunk:
  https://bugs.swift.org/browse/SR-3152?jql=text%20~%20%22C%2B%2B%22%20ORDER%20BY%20created%20DESC

In the meantime, you can either use a recent snapshot from swift.org, or you can pass `-Xlinker -lc++` on the command line to work around the problem.

 - Daniel

> On Nov 12, 2016, at 1:42 PM, Vinicius Vendramini via swift-users <swift-users at swift.org> wrote:
> 
> I’m having issues using C++ code with the Swift PM. Simple examples work fine as long as I don’t use anything in the C++ standard library, otherwise the programs don’t compile.
> 
> My guess is that the Swift PM internally uses clang (as opposed to clang++) to compile C++ code, and while clang can compile normal C++ code it can’t link against the C++ standard library. Is that it?
> 
> The second example on the link below shows working C++ code with Swift. If I try to add a simple call to std::cout, for instance, the program stops compiling.
> 
> Thanks for any help :)
> 
> link: http://ankit.im/swift/2016/05/21/creating-objc-cpp-packages-with-swift-package-manager/ <http://ankit.im/swift/2016/05/21/creating-objc-cpp-packages-with-swift-package-manager/>
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161112/7fbd2091/attachment.html>


More information about the swift-users mailing list