C ++中的自动链接库如何工作? [英] How does Auto-Linking libraries in C++ work?

查看:55
本文介绍了C ++中的自动链接库如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动链接以下库.我从未使用过自动链接功能,也不确定它的工作原理.根据我的研究,这应该可行.当我在SDL库之外将dll包含到项目中时,出现以下错误: https://i.gyazo.com/e49a636ddad428fa48acdee78c930293.png

I am trying to auto-link following libraries. I've never used auto-linking feature and not sure how it works exactly. From my research this should work. When I include the dll to the project besides the SDL libraries I get following errors: https://i.gyazo.com/e49a636ddad428fa48acdee78c930293.png

要使自动链接正常工作,需要执行哪些步骤.我不需要为此指定某种路径吗?一定要按特定顺序吗?

What are the steps to get Auto-linking working. Don't I need to specify some kind of path for this? Does it have to be in specific order?

此代码位于DLL中:

#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
#include <SDL_ttf.h>

#pragma comment(lib, "SDL2.lib")
#pragma comment(lib, "SDL2main.lib")
#pragma comment(lib, "SDL2_image.lib")
#pragma comment(lib, "SDL2_mixer.lib")
#pragma comment(lib, "SDL2_ttf.lib")

感谢您抽出宝贵的时间来回答问题.

Thank you for taking your time to answer.

推荐答案

编译器抱怨它找不到 header sdl.h,它没有到达链接部分(并且我猜那里也有麻烦.)

The compiler complains that it can't find the header sdl.h, it hasn't gotten to the linking part (and I'm guessing it would have trouble there too).

解决:

  1. 在此处将路径添加到SDL标头:项目属性\ C/C ++ \常规\其他包含目录
  2. 在此处将导入库的路径添加到:项目属性\ Linker \ General \其他库目录.

不要摆弄"VC ++目录"-顾名思义,它是工具链寻求各种VC组件(crt,mfc,open mp,windows sdk等)的地方.搞砸了,可能会导致很难诊断出构建失败.

Don't fiddle with 'VC++ directories' - as the name suggests, it is where the toolchain seeks various VC components (crt, mfc, open mp, windows sdk etc.). Messing this up could result in extremely hard to diagnose build failures.

这篇关于C ++中的自动链接库如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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