简体   繁体   English

带有f#问题的OpenTk(“命名空间或模块OpenTK”)

[英]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. 我知道带有opentk的f#与c#可以很好地进行翻译,但是由于f#并不是很受欢迎,因此我的问题不太明显。

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. 我在参考资料中也列出了OpenTK,所以不确定。

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. 当您缺少对定义OpenTK的库的引用时,会遇到此错误。 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. 脚本文件 -如果您使用的是.fsx文件,则需要使用#r命令引用程序集。 I wrote a demo that does exactly this and builds a little 3D DSL. 我编写了一个演示文件,该演示文件正是这样做的,并构建了一些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. 项目 -如果您在项目中 ,则可以在Visual Studio中添加引用来解决问题。 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. 如果出了点问题,请查看构建日志-如果您引用的是不兼容的dll版本(例如,.NET的另一个版本),则会在此处看到详细的错误。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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