[英]XCode12 Allegro "file not found"
I could use some help solving a linker error.我需要一些帮助来解决 linker 错误。 Could just be because I'm new to developing for MacOS.
可能只是因为我是 MacOS 开发新手。 I got my Allegro Libraries off of Homebrew by using
brew install allegro
.我使用
brew install allegro
从 Homebrew 中获取了我的 Allegro 库。 I followed the steps on the tutorial I watched nearly to a tee, as I opened XCode to make a Cocoa app, went to the target, edited my build settings, and changed my Header search path to /usr/local/include/**
and my Library search path to /usr/local/lib/**
, as well as set my Framework search path to /Library/Frameworks/**
.当我打开 XCode 制作一个 Cocoa 应用程序时,我按照我几乎看完的教程中的步骤进行操作,转到目标,编辑我的构建设置,并将我的 Header 搜索路径更改为
/usr/local/include/**
将我的库搜索路径设置为/usr/local/lib/**
,并将我的框架搜索路径设置为/Library/Frameworks/**
。 I set my C++ dialect to GNU++11.我将我的 C++ 方言设置为 GNU++11。 I went back into my terminal, where I used the commands to pull up my Allegro libraries in the Cellar.
我回到我的终端,在那里我使用命令在 Cellar 中调出我的 Allegro 库。 I picked out all the necessary files to make the game work, and then drag n' dropped them all into my linked frameworks and libraries.
我挑选了让游戏运行所需的所有文件,然后将它们全部拖放到我的链接框架和库中。 I created a Copy Files build phase with a destination of my frameworks, and drag n' dropped those same Allegro files into it as folder references as shown here: My files After all that, it was time to create my main.cpp.
我创建了一个以我的框架为目标的复制文件构建阶段,并将那些相同的 Allegro 文件拖放到其中作为文件夹引用,如下所示:我的文件毕竟,是时候创建我的 main.cpp 了。
#include <stdio.h>
#include <vector>
#include <allegro5\allegro.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_acodec.h>
#include <allegro5\allegro_audio.h>
// ...
...and there in laid the problem. ……问题就在这里。 I had gotten the error:
'allegro5\allegro.h' file not found
.我收到错误:
'allegro5\allegro.h' file not found
。 Upon double checking by commenting out the troublesome lines, it had turned out none of the files I #included could be found.通过注释掉麻烦的行来仔细检查,结果发现我#included 的文件都找不到。 Is there some kind of step I'm missing?
我缺少某种步骤吗?
Well that was weird.好吧,那很奇怪。 I ran the code and suddenly all the errors went away.
我运行了代码,突然所有的错误都消失了。 XCode can be so weird sometimes.
XCode 有时会很奇怪。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.