简体   繁体   English

错误FS0039:未定义字段,构造函数或成员'X'

[英]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.

相关问题 F# 错误 FS0039:未定义值或构造函数“输入” - F# error FS0039: The value or constructor 'input' is not defined F#错误FS0039:未定义类型'XmlProvider' - F# error FS0039: The type 'XmlProvider' is not defined 为什么我在 class 未定义的参数中收到错误提示 function - 错误 FS0039:值或构造函数“函数”未定义 - Why I get error saying function in argument for a class not defined - error FS0039: The value or constructor 'function' is not defined XmlProvider FS0039中的DomainTypes未定义 - DomainTypes in XmlProvider FS0039 not defined F# CsvProvider can't find member in Row error FS0039 - F# CsvProvider cant find member in Row error FS0039 F#错误'错误FS0039:未定义名称空间或模块'MySql'? - F# error 'error FS0039: The namespace or module 'MySql' is not defined'? 为什么在错误 FS0039 The type 'JsonProvider' is not defined 时程序仍在运行? - Why is the program still running while Error FS0039 The type 'JsonProvider' is not defined? 为什么会出现F#错误FS0039:未定义名称空间或模块'Http' - Why am I getting F# error FS0039: The namespace or module 'Http' is not defined 使用F#查询表达式时收到此消息:错误FS0039:未定义值或构造函数“查询” - I got this msg while using F# query expression : error FS0039: Undefined value or constructor “query” Azure存储类型提供程序:构建时为FS0039,但智能感知显示类型为可用 - Azure Storage Type Provider: FS0039 on build but intellisense shows type as available
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM