cannot compile allegro using visual c++

南楼画角 提交于 2019-12-11 00:32:40

问题


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


回答1:


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:

  • open the Visual Studio command prompt
  • cd c:\allegro
  • mkdir build
  • cd build
  • cmake ..
  • 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.)

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.




回答2:


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.



来源:https://stackoverflow.com/questions/4309113/cannot-compile-allegro-using-visual-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!