在 Visual Studio C# 中引用 SDL2 [英] Referencing SDL2 in a Visual Studio C#

查看:222
本文介绍了在 Visual Studio C# 中引用 SDL2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图形库Veldrid抛出:

Could not find or load the native library from any name: [ SDL2.dll ]

当我尝试从 教程在一个新的 C# 控制台应用程序中,.NET v4.7.1.

when I try to run the example from the tutorial in a new C# Console Application, .NET v4.7.1.

当我尝试引用 SDL2 dll 时,Visual Studio 只显示A无法添加对 'C:\...\SDL2.dll' 的引用"

When I try to reference the SDL2 dll, Visual Studio simply shows "A reference to 'C:\...\SDL2.dll' could not be added"

我需要额外的包装器吗?Veldrid.StartupUtilities 已经被认为是 SDL2 的一个简单包装器.

Do I need any additional wrappers? Veldrid.StartupUtilities is already supposed to be a simple wrapper for SDL2.

我需要使用不同的 .NET 版本吗?

Do I need to use a different .NET version?

推荐答案

我右击我的项目,选择 Add > Existing Item,选择 SDL2.dll随 Veldrid 下载一起提供,单击 Add > As Link,将其 Property OnBuild 设置为 Copy if new and一切正常.

I right-clicked my project, selected Add > Existing Item, selected the SDL2.dll supplied with the Veldrid download, clicked Add > As Link, set its Property OnBuild to Copy if newer and everything worked.

这篇关于在 Visual Studio C# 中引用 SDL2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆