简体   繁体   中英

OpenTk with f# issue ("namespace or module OpenTK)

I know f# with opentk is very translatable from c#, however my problem is slightly less obvious because of the fact that f# isn't incredibly popular as it is.

From writing

open OpenTK

right of the bat I get

The namespace or module 'OpenTK' is not defined 

I also listed OpenTK in my references, so I'm not sure.

I did research, but as always there's going to be something that escaped my searches, so I thought that someone more knowledgeable in the first place might be of assistance.

If there's a better way or place to post this please let me know.

This is an error that you get when you're missing a reference to a library where OpenTK is defined. There are two ways of adding references, depending on whetehr you're in a project or in a script file.

Script file - if you're working in a .fsx file, you need to reference assemblies using the #r command. I wrote a demo that does exactly this and builds a little 3D DSL. The file starts with:

#r "references/OpenTK.dll"
open OpenTK

Project - if you're inside a project than adding reference in Visual Studio should do the trick. If something goes wrong, check out the build log - if you were referencing incompatible version of the dll (eg for another version of .NET), you'd see a detailed error there.

如果您也遇到此问题,请转到

PROJECTS > Manage NuGet Packages > Online > search "OpenTK".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM