[swift-users] Autoreleasepool for Ubuntu

Bernardo Breder bernardobreder at gmail.com
Tue Nov 1 20:40:56 CDT 2016


Hello,

I want to create a mini http server project and execute at Ubuntu 15. The
Xcode compile and access the function "autoreleasepool", but when i compile
the same code at Ubuntu, this function not found

For example, i can compile the code above at Xcode:

while true {
    autoreleasepool {
    var test: Data = "HTTP/1.1 200 OK\r\nContent-Length:
1\r\n\r\na".data(using: .utf8)!
    }
}

But when i try to compile at Ubuntu:

git at breder:~$ cat main.swift
import Foundation

while true {
    autoreleasepool {
    var test: Data = "HTTP/1.1 200 OK\r\nContent-Length:
1\r\n\r\na".data(using: .utf8)!
    }
}

git at breder:~$ swiftc main.swift
main.swift:4:5: error: use of unresolved identifier 'autoreleasepool'
    autoreleasepool {
    ^~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161101/3b734acd/attachment.html>


More information about the swift-users mailing list