简体   繁体   English

assimp导入失败的Xcode

[英]assimp import failing on Xcode

What I'm trying to do 我想做什么

... to import assimp, specifically: ...导入assimp,具体来说:

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

and some other assimp headers. 和其他一些assimp标题。

I'm using xcode 10.2.1 . 我正在使用xcode 10.2.1

The errors im getting: 我得到的错误:

在此输入图像描述

What I tried 我尝试了什么

  • I imported assimp in Link Binary With Libraries, which was installed with brew install assimp 我在Link Binary With Libraries中导入了assimp,它与brew install assimp一起brew install assimp

  • I reinstalled assimp with brew reinstall assimp , just in case. 为了以防万一,我重新安装了使用brew reinstall assimp

在此输入图像描述

Nothing has changed. 什么也没有变。 Xcode still can't resolve the dependency. Xcode仍然无法解决依赖关系。

I tried deleting the import the error is pointing on, but it just showed up at the next assimp import again, as in, xcode can't resolve the import, even though I added libassimp4.1.0.dylib from /usr/local/Cellar/assimp/4.1.0/lib . 我尝试删除错误指向的导入,但它刚刚出现在下一个assimp导入,因为,xcode无法解析导入,即使我从/usr/local/Cellar/assimp/4.1.0/lib添加了libassimp4.1.0.dylib /usr/local/Cellar/assimp/4.1.0/lib I'm lost here. 我迷失在这里。 This is supposed to work, but it doesn't. 这应该可行,但事实并非如此。 I imported other libs this way and never had an issue. 我以这种方式导入了其他库,从来没有遇到过问题。

I fixed it and this is how: 我修好了,这就是:

I fixed the compiler error by pointing xcode to the headers. 我通过将xcode指向标题来修复编译器错误。 It somehow didn't work with the homebrew installation, so I added this manually. 它在某种程度上不适用于自制软件安装,所以我手动添加了它。

In your App settings, go to: build settings 在您的应用程序设置中,转到: 构建设置

scroll down to: search paths 向下滚动到: 搜索路径

there, find: header search paths 在那里,找到: 标题搜索路径

double click on it, then add by clicking + 双击它,然后单击+添加

add: /usr/local/Cellar/assimp/4.1.0/include as non-recursive add: /usr/local/Cellar/assimp/4.1.0/include as non recursive

Disclaimer: 免责声明:

Depending on how you installed it or if or if not you installed Homebrew systemwide, which is not recommended, assimp might live in a different directory. 根据您的安装方式或是否安装了Homebrew系统(不推荐使用),assimp可能位于不同的目录中。 In my case it was /usr/local/Cellar/ 在我的情况下它是/usr/local/Cellar/

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

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