无法使用 Visual C++ 编译 allegro
我刚刚下载了 allegro 库,
我创建了一个新的空项目,然后添加一个源文件
,我添加了这行代码:
#include <allegro.h>
我编译并收到以下错误:
c:\allegro\include\allegro5\internal\alconfig.h(28):致命错误 C1083:无法打开包含文件:'allegro5/platform/alplatf.h':没有这样的文件或目录
所以我进入 alconfig.h 并更改:
#include "allegro5/platform/alplatf.h"
到:
#include "../../allegro5/platform/alplatf.h.cmake"
它现在给了我这个错误:
c:\allegro\include\allegro5\platform\alplatf.h.cmake(2):致命错误 C1021:无效的预处理器命令“cmakedefine”
所以我摆脱了 #include "../../allegro5/ platform/alplatf.h.cmake”
语句 it then 说:
c:\allegro\include\allegro5\internal\alconfig.h(57):致命错误 C1189:#error:平台不支持
我不知道从那里开始,我正在运行 Windows,所以我真的很困惑
I just downloaded the allegro library
I make a new empty project then add a source file
I add this line of code:
#include <allegro.h>
I compile and get the following error:
c:\allegro\include\allegro5\internal\alconfig.h(28) : fatal error C1083: Cannot open include file: 'allegro5/platform/alplatf.h': No such file or directory
so I go into alconfig.h and change:
#include "allegro5/platform/alplatf.h"
to:
#include "../../allegro5/platform/alplatf.h.cmake"
it now gives me this error:
c:\allegro\include\allegro5\platform\alplatf.h.cmake(2) : fatal error C1021: invalid preprocessor command 'cmakedefine'
so I get rid of the #include "../../allegro5/platform/alplatf.h.cmake"
statement it then says:
c:\allegro\include\allegro5\internal\alconfig.h(57) : fatal error C1189: #error : platform not supported
I do not know were to go from there, I am running windows so I really am stumped
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您正在尝试使用源版本,甚至没有构建它。请参阅随附的说明,了解如何构建它的信息。简而言之,您需要安装 cmake 并执行以下操作:
此时,应该构建 Allegro。您还可以通过向
cmake -G "Visual Studio ..."
提供适当的选项来创建 MSVC 项目文件。然后您可以从 Visual Studio 中构建 Allegro。 (尽管运行nmake
可能更快且更少麻烦。)如果您想要构建除通用安装之外的任何内容,则必须拥有所有依赖项。我强烈建议您从以下位置下载适用于 Windows 的预构建二进制文件:
并忽略上面所有关于如何自己构建它的内容。
It looks like you are trying to use the source version without even building it. Please see the included instructions for information on how to build it. In short, you need to install cmake and do the following:
At that point, Allegro should be built. You could also create MSVC project files instead by supplying the appropriate option to
cmake -G "Visual Studio ..."
. Then you could build Allegro from within Visual Studio. (Although runningnmake
is probably faster and less hassle.)You must have all the dependencies if you want to build anything but a generic installation. I'd highly recommend that you just download a prebuilt binary for Windows from:
and ignore all of the above about how to build it yourself.
在本教程中,您可以将 Allegro 5 安装到 Microsoft Visual Studio 2010 Express。我不认为会有那么多差异。
In this tutorial you can Install Allegro 5 to Microsoft Visual Studio 2010 Express. I don't think that there would be so many differences.