无法使用Visual C ++编译Allegro

编程入门 行业动态 更新时间:2024-10-26 14:40:54
本文介绍了无法使用Visual C ++编译Allegro的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚下载了allegro库

I just downloaded the allegro library

我创建了一个新的空项目,然后添加了源文件

I make a new empty project then add a source file

我添加以下代码行:

#include <allegro.h>

我编译并得到以下错误:

I compile and get the following error:

c:\allegro\include\allegro5\internal\alconfig.h(28):致命错误C1083:无法打开包含文件:'allegro5 / platform / alplatf.h' :没有这样的文件或目录

c:\allegro\include\allegro5\internal\alconfig.h(28) : fatal error C1083: Cannot open include file: 'allegro5/platform/alplatf.h': No such file or directory

所以我进入alconfig.h并更改:

so I go into alconfig.h and change:

#include "allegro5/platform/alplatf.h"

至:

#include "../../allegro5/platform/alplatf.h.cmake"

现在现在给我这个错误:

c:\allegro\include\allegro5\platform\alplatf.h.cmake(2):致命错误C1021:无效的预处理程序命令'cmakedefine'c:\allegro\include\allegro5\platform\alplatf.h.cmake(2) : fatal error C1021: invalid preprocessor command 'cmakedefine'

所以我摆脱了 #include ../../allegro5/platform/alplatf.h。 cmake 语句然后说:

c:\allegro\包括\allegro5\内部\ fig.h(57):致命错误C1189:#error:不支持平台

c:\allegro\include\allegro5\internal\alconfig.h(57) : fatal error C1189: #error : platform not supported

我不知道该去哪里,我正在运行Windows,所以我真的很困惑。

I do not know were to go from there, I am running windows so I really am stumped

推荐答案

您似乎在尝试使用源代码版本而没有构建它。请参阅随附的说明以获取有关如何构建它的信息。简而言之,您需要安装cmake并执行以下操作:

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:

  • 打开Visual Studio命令提示符
  • cd c:\allegro
  • mkdir build
  • cd build
  • cmake ..
  • nmake
  • open the Visual Studio command prompt
  • cd c:\allegro
  • mkdir build
  • cd build
  • cmake ..
  • nmake

此时,应该构建Allegro。您还可以通过为 cmake -G Visual Studio ... 提供适当的选项来创建MSVC项目文件。然后,您可以在Visual Studio中构建Allegro。 (尽管运行 nmake 可能更快,更省事。)

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 running nmake is probably faster and less hassle.)

如果要生成除通用安装之外的任何内容。我强烈建议您从以下位置下载适用于Windows的预编译二进制文件:

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:

  • www.allegro.cc/files
  • www.allegro.cc/files

忽略以上所有有关如何自行构建的内容。

and ignore all of the above about how to build it yourself.

更多推荐

无法使用Visual C ++编译Allegro

本文发布于:2023-11-10 06:38:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Visual   Allegro

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!