2014-12-09 22 views
5

Tôi đã cài đặt FsUnit bằng NuGet trên Mac OS. Và tôi đã sao chép dll-s vào thư mục lib:Cách đặt đường dẫn gói cho fsharpc trên Mac OS

$ ls -la lib 
total 1336 
drwxr-xr-x 5 demas staff  170 Dec 9 23:39 . 
drwxr-xr-x 17 demas staff  578 Dec 9 23:39 .. 
-rw-r--r-- 1 demas staff 488448 Dec 9 23:21 FsCheck.dll 
-rw-r--r-- 1 demas staff 39424 Dec 9 23:20 FsUnit.NUnit.dll 
-rw-r--r-- 1 demas staff 151552 Dec 9 23:20 nunit.framework.dll 

Đây là mã của tôi:

#light 
namespace Tests 
open NUnit.Framework 
open FsUnit 

module module1 = 
    let inline public Square x = x * x; 

Bây giờ tôi đang cố gắng để biên dịch mã của tôi, nhưng có được các thông báo lỗi:

$ fsharpc --lib:lib some.fs    
F# Compiler for F# 3.1 (Open Source Edition) 
Freely distributed under the Apache 2.0 Open Source License 

/Users/demas/temporary/under/some.fs(3,6): error FS0039: The namespace or module 'NUnit' is not defined 
/Users/demas/temporary/under/some.fs(4,6): error FS0039: The namespace or module 'FsUnit' is not defined 
/Users/demas/temporary/under/some.fs(9,7): error FS0039: The type 'TestFixture' is not defined 

Có vẻ như fsharpc không thể tìm thấy libs của tôi. Làm thế nào tôi có thể sửa chữa nó ?

Trả lời

3

Trình biên dịch không tự động xem tất cả các thư viện. Bạn cần sử dụng -r để đặt tên rõ ràng các thư viện cần được tham chiếu:

fsharpc --lib:lib -r:nunit.framework.dll -r:FsUnit.NUnit.dll -r:FsCheck.dll some.fs 
Các vấn đề liên quan