Alan Mulligan
Alan Mulligan

Reputation: 1198

error FS0039: The field, constructor or member 'X' is not defined

I am trying to run my code interactively in an fsx file. 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"

Dose the 'getExchangeRates' not get defined when i load "HttpGetExchangeRate.fs"as in the image below or an I missing something?

#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 enter image description here

Upvotes: 4

Views: 4084

Answers (2)

latkin
latkin

Reputation: 16792

If I understand your scenario correctly, this is due to a bug in how namespaces are handled in FSI. The workaround is to open the namespace you need before #loading the second file

#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).

Upvotes: 4

Wayne Tanner
Wayne Tanner

Reputation: 1356

It sounds like you are running into the issue described in this question with implicit modules in fsi.

How to load external F# code and use it in fsi

Upvotes: 0

Related Questions