[英]error FS0039: The field, constructor or member 'X' is not defined
I am trying to run my code interactively in an fsx file. 我试图在fsx文件中交互式运行我的代码。 I have loaded all the dlls required, I then try to load the required files with #load but when I load the "Utlities.fs" file which depends on a function in the top file "HttpGetExchangeRate.fs" i get the error "Utilities.fs(88,42): error FS0039: The field, constructor or member 'getExchangeRates' is not defined"
我已经加载了所需的所有dll,然后尝试使用#load加载所需的文件,但是当我加载“ Utlities.fs”文件时,该文件取决于顶部文件“ HttpGetExchangeRate.fs”中的函数,因此出现错误“ Utilities .fs(88,42):错误FS0039:未定义字段,构造函数或成员'getExchangeRates'“
Dose the 'getExchangeRates' not get defined when i load "HttpGetExchangeRate.fs"as in the image below or an I missing something? 如下图所示,当我加载“ HttpGetExchangeRate.fs”时,是否未定义“ getExchangeRates”剂量?
#load "HttpGetExchangeRate.fs"
#load "Utilities.fs"
open System
open FsCheck
open NUnit.Framework
open HttpClient
InvoiceApp.Http.getExchangeRates "EUR" "USD"
InvoiceApp.Math.convertInvoicingCurrencyToEuro 200.00M "EUR"
Here is an image of the error message 这是错误消息的图像
If I understand your scenario correctly, this is due to a bug in how namespaces are handled in FSI. 如果我正确理解了您的情况,那是由于FSI处理名称空间的方式存在错误。 The workaround is to
open
the namespace you need before #load
ing the second file 解决方法是在
#load
第二个文件之前open
所需的名称空间
#load "HttpGetExchangeRate.fs"
open InvoiceApp
#load "Utilities.fs"
That should get you unblocked for now, the bug has since been fixed (F# 4.0/VS 2015 will have the fix). 那应该暂时让您畅通无阻,此错误已得到修复 (F#4.0 / VS 2015将具有此修复程序)。
It sounds like you are running into the issue described in this question with implicit modules in fsi. 听起来您好像正在使用fsi中的隐式模块遇到此问题中描述的问题。
How to load external F# code and use it in fsi 如何加载外部F#代码并在fsi中使用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.