如何向 Visual Studio 项目添加其他库?

发布于 2024-10-07 19:14:24 字数 158 浏览 4 评论 0原文

Allergro 是一个用于图形操作的开源 C++ 插件库。如何将此库添加到我的编译器中?

这些说明对我不起作用,因为我使用的是 Windows 7。我不知道操作系统是否重要。我有 Visual Studio Express 版本。该库是一个 .dll 文件。如何将其添加到我的项目中?

Allergro is an open souce C++ addon library for graphics manipulation. How do I add this library to my compiler?

The instructions don't work for me as I have Windows 7. I don't know if the OS matters. I have the Visual Studio Express Edition. The library is a .dll file. How do I add it to my projects?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

别想她 2024-10-14 19:14:25

对于 Visual Studio,您需要在解决方案资源管理器中右键单击您的项目,然后单击属性

接下来打开配置属性,然后打开链接器

现在您想要将包含 Allegro 库的文件夹添加到其他库目录

链接器 -> 输入您将在其他依赖项下添加实际的库文件。

对于头文件,您还需要将其目录包含在 C/C++ -> 下。 其他包含目录

如果有dll,请在主项目文件夹中复制它,然后就完成了。

我建议将 Allegro 文件放入项目文件夹中,然后对库和头目录使用本地引用。

这样做将允许您在其他计算机上运行该应用程序,而无需在其他计算机上安装 Allergo。

这是为 Visual Studio 2008 编写的。对于 2010,它应该大致相同。

For Visual Studio you'll want to right click on your project in the solution explorer and then click on Properties.

Next open Configuration Properties and then Linker.

Now you want to add the folder you have the Allegro libraries in to Additional Library Directories,

Linker -> Input you'll add the actual library files under Additional Dependencies.

For the Header Files you'll also want to include their directories under C/C++ -> Additional Include Directories.

If there is a dll have a copy of it in your main project folder, and done.

I would recommend putting the Allegro files in the your project folder and then using local references in for the library and header directories.

Doing this will allow you to run the application on other computers without having to install Allergo on the other computer.

This was written for Visual Studio 2008. For 2010 it should be roughly the same.

少女七分熟 2024-10-14 19:14:25

#pragma comment(lib, "Your library name here") 添加到您的源代码中。

Add #pragma comment(lib, "Your library name here") to your source.

负佳期 2024-10-14 19:14:25

在不了解您的编译器的情况下,没有人可以为您提供具体的逐步说明,但基本过程如下:

  1. 指定应搜索的路径以找到实际的库(通常在“库搜索路径”、“库”下)属性页中的目录等)

  2. 在链接器选项下,指定库的实际名称。在 VS 中,您可以编写 Allegro.lib(或其他任何内容),在 Linux 上您通常只编写 Allegro(大多数情况下会自动添加前缀/后缀)。这通常位于“Libraries->Input”下,只是“Libraries”或类似的内容。

  3. 确保您已包含库的标头并确保可以找到它们(与步骤 #1 和 #2 中列出的过程类似)。如果是静态库就应该没问题;如果它是 DLL,则需要将其复制到项目中。

  4. 混搭构建按钮。

Without knowing your compiler, no one can give you specific, step by step instructions, but the basic procedure is as follows:

  1. Specify the path which should be searched in order to find the actual library (usually under Library Search Paths, Library Directories, etc. in the properties page)

  2. Under linker options, specify the actual name of the library. In VS, you would write Allegro.lib (or whatever it is), on Linux you usually just write Allegro (prefixes/suffixes are added automatically in most cases). This is usually under "Libraries->Input", just "Libraries", or something similar.

  3. Ensure that you have included the headers for the library and make sure that they can be found (similar process to that listed in step #1 and #2). If it is a static library, you should be good; if it's a DLL, you need to copy it in your project.

  4. Mash the build button.

凯凯我们等你回来 2024-10-14 19:14:25

这个描述非常模糊。你尝试了什么,又是如何失败的。

要将库包含在您的项目中,您必须将其包含在传递给链接器的模块中。执行此操作的确切步骤取决于您使用的工具。该部分与操作系统无关。

现在,如果您成功地将库编译到您的应用程序中但它无法运行,则可能与操作系统有关。

This description is very vague. What did you try, and how did it fail.

To include a library with your project, you have to include it in the modules passed to the linker. The exact steps to do this depend on the tools you are using. That part has nothing to do with the OS.

Now, if you are successfully compiling the library into your app and it doesn't run, that COULD be related to the OS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文