无法使用Visual C ++编译Allegro [英] cannot compile allegro using visual c++

查看:143
本文介绍了无法使用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:

  • http://www.allegro.cc/files

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

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

这篇关于无法使用Visual C ++编译Allegro的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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