Assimp模型加载库安装/链接的麻烦 [英] Assimp model loading library install/linking troubles

查看:699
本文介绍了Assimp模型加载库安装/链接的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装Assimp以在我的项目中使用,但是遇到了一些麻烦.我目前正在使用Win 10 Pro和Visual Studio 152017.

I'm trying to install Assimp to use in my projects, but I'm having some trouble. I'm currently using win 10 pro and visual studio 15 2017.

  1. 我已经下载了Assimp 4.0.1.zip,将其提取到目录中,加载了cmakeGui并运行了两次配置,然后生成到Assimp/build目录中.

  1. I have downloaded Assimp 4.0.1.zip, extracted it into a directory, loaded cmakeGui and ran configuration twice, then generated into Assimp/build directory.

接下来,我进入Assimp/build,运行Assimp.sln并选择了我认为是的ALL_BUILD.然后,我将.lib和.dll旁边的所有文件复制到/code/debug中,并将它们全部移动到我的exe所构建的项目的Debug目录中.我将.lib复制到了我的opengl/libs目录中,并将/include中的所有标头从最初提取的下载文件中复制到了我的opengl/includes/assimp目录中.

Next I went into Assimp/build and I ran the Assimp.sln and chose the ALL_BUILD I think it was. I then copied all the files in the /code/debug that were alongside the .lib and .dll and moved them all into the Debug directory of my project where my exe is built to. I copied the .lib into my opengl/libs directory and all the headers in /include from the originally extracted download into my opengl/includes/assimp directory.

最后,我调整了项目的链接器设置,使其包含assimp.lib和assimp.dll(为简化本文而使用的别名)

Finally, I adjusted my projects linker settings to include the assimp.lib and assimp.dll (alias for simplicity of this post)

当我尝试构建项目时,它说它无法打开dll,并且当我尝试将dll与main.cpp和我的其他文件一起复制到项目目录中并再次运行时,这次它表示无效或损坏的文件:无法在0x378处读取

When I tried to build the project it said it could not open the dll and when experimenting I copied the dll into the project dir alongside main.cpp and my other files and ran again, it this time said "invalid or corrupt file: cannot read at 0x378"

可以肯定地说,我需要学习编译,链接和cmake,但现在我重新开始.

It's safe to say I need to study up on compiling, linking and cmake but for now I started over.

当我将标题包含到项目中时,我停止抱怨了,我认为我已经开始工作了(也许我做了...).为此,我与以前一样从全新构建的Assimp开始,将所有带有dll的文件移动到我的libs目录中,将所有包含的内容从下载中转储到我的包含中,还将config.h从内部版本移至该目录中.然后,我在项目中设置了链接器设置,并且没有将任何内容移入我的项目目录.

I thought I had it working(and maybe I do...) after I got it to stop complaining when I was including the headers into my project. To do so I started from fresh, built Assimp same as before, moved all the files with the dll into my libs directory, dumped all the includes from the download into my includes, also move the config.h from the build into this directory. Then I set the linker settings in the project and didn't move anything into my project directories.

此后,它不再抱怨了,所以我继续我所关注的教程系列.我编译了很多错误,将错误固定为0,然后突然我替换了8个新错误.

After that, it stopped complaining so I proceeded with the tutorial series I was following. I compiled, got a load of errors, fixed them down to 0 then suddenly I got 8 new ones in their place.

严重性代码描述项目文件行抑制状态 错误LNK2019无法解析的外部符号_aiGetMaterialTextureCount在函数"public:unsigned int __thiscall aiMaterial :: GetTextureCount(enum aiTextureType)const"((?GetTextureCount @ aiMaterial @@ QBEIW4aiTextureType @@@@ Z)中引用入门\ opengl_model_loading \ opengl_model_loading \ main.obj 1

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _aiGetMaterialTextureCount referenced in function "public: unsigned int __thiscall aiMaterial::GetTextureCount(enum aiTextureType)const " (?GetTextureCount@aiMaterial@@QBEIW4aiTextureType@@@Z) opengl_model_loading F:\Desktop\MyDocuments\Tuts\opengl\getting started\opengl_model_loading\opengl_model_loading\main.obj 1

此错误给我的感觉可能是由于dll. 请告知.

This error gave me the feeling it was probably due to the dll. Please advise.

推荐答案

我最近刚刚完成了此操作&会说v401& amp;出现错误或链接问题.成功让我的与以下人员一起工作;

I've just recently done this myself & will say had lot of trouble with v401 & getting errors or linking issues. Successfully got mine working with following;

注意:ASSIMP确实具有boost作为依赖项.

Note: ASSIMP does have boost as a dependency.

  1. 从github下载/克隆主Asset-Importer-Lib: https://github.com/assimp/assimp
  2. 打开Cmake GUI&打开后:

  1. Download/clone master Asset-Importer-Lib from github: https://github.com/assimp/assimp
  2. Open Cmake GUI & once open:

  • 源代码在哪里:".. \ MyDocuments \ assimp \ assimp-master"
  • 在何处生成二进制文件:".. \ MyDocuments \ assimp \ assimp-master \ build".您需要制作一个构建文件夹&将Cmake指向它.

2.1.或者,如果您熟悉命令行选项:使用

2.1. Alternatively if you're familiar with command line option: generate project files with relevant paths using

  • cmake -G"Visual Studio 14 Win64"

只需确保您正在为代码构建正确的库,即32/64bit/debug/release/unicode/etc,否则可能仍然遇到问题.

Just ensure you're building right libraries for your code ie 32/64bit/debug/release/unicode/etc, otherwise may encounter issues still.

以下视频对于视觉倾斜很有用. https://youtu.be/W_Ey_YPUjMk

Following video is useful for the visually inclined. https://youtu.be/W_Ey_YPUjMk

希望这会有所帮助.

如果您需要静态库版本,即不需要.dll: 通过以上步骤:

If you want static library version ie no .dll required: From above steps:

5.1.更改相关的项目配置类型和从.dll扩展到.lib类型(应该是两个:assimp& zlib).

5.1. Change relevant project configuration type & extension from .dll to .lib type (should be two: assimp & zlib).

5.2.右键单击"UpdateAssimpLibsDebugSymbolsAndDLLs"->属性"->构建事件"和将命令行部分中的路径从.. \ Path * .dll更新为.. \ Path * .lib. (如果遇到错误,请在assimp_cmd项目上执行相同的操作.)

5.2. Right click "UpdateAssimpLibsDebugSymbolsAndDLLs" ->Properties->Build Events & update the paths in the command line sections from ..\Path*.dll to ..\Path*.lib. (If encounter errors, do same on assimp_cmd project).

  1. 与上述相同,但现在还需要将您的项目链接到IrrXML.lib& zlibd.lib.应该不再需要* .dll文件.

这篇关于Assimp模型加载库安装/链接的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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