Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Unable to compile Allegro5 with msvc 14.

This thread is locked; no one can reply to it. rss feed Print
Unable to compile Allegro5 with msvc 14.
ZenRowe
Member #16,081
September 2015

NOTE: I found the solution to my problem, I've detailed it at the bottom of this post as the thread was already closed by the time I had figured it out.

Hello, I will admit I am pretty novice with compiling using the command prompt. I've been fighting with this most of the day, browsing the forums looking through documents and trying to make sure that I had all of the dependencies.

I am using the Scripts that SiegeLord had posted a while ago, and I thought I had figured it out. I managed to get the dependencies to compile with no errors, however when I go to compile allegro I get the following 4 errors. They have me stumped but I'm hoping someone here who might recognize them?

"Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\INSTALL.vcxproj" (default target) (1) ->
"Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\ALL_BUILD.vcxproj" (default target) (2) ->
"Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\allegro.vcxproj" (default target) (4) ->
(ClCompile target) ->
  Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\allegro\src\file_stdio.c(315): error C2065: 'PATH_MAX' : undeclared identifier [Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\allegro.vcxproj]
  Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\allegro\src\file_stdio.c(315): error C2057: expected constant expression [Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\allegro.vcxproj]
  Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\allegro\src\file_stdio.c(315): error C2466: cannot allocate an array of constant size 0 [Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\allegro.vcxproj]
  Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\allegro\src\file_stdio.c(315): error C2133: 'filename' : unknown size [Z:\Users\Zen\Desktop\allegrowinpackagemaster\allegro_winpkg-master\universal\build_msvc_64\allegro\allegro.vcxproj]

*EDIT: Apologies I should have included some other potentially information as well.
Allegro Version: 5.0.10 (64)
OS: Windows 10

*EDIT 2: (I'm not sure why the thread got closed but I did find the culprit of my error detailed below)

First off, I need to fill out an id-10-t because I did not update the tool chain which was why I was getting massive errors with Allegro build 5.1.11. I only discovered what to change it to by poking and prodding because apparently googling "msvc toolchain" doesn't come up with useful answers. :'(

5.1.11 I had to build with v140, however I still get the following error when trying to use this build:

 C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um\urlmon.h(7876): error C2504: 'IZoneIdentifier': base class undefined [C:\universal\build_msvc_64\allegro\allegro.vcxproj]

if anybody knows how to fix this problem, please let me know

toolchain v140 DID work just fine with 5.0.10 however.

Second, the errors I was getting with the stable build 5.0.10 was the result of the following line:

\allegro\src\file_stdio.c(315): char filename[PATH_MAX];

Line 315 of file_stdio.c uses PATH_MAX however there is no #ifdef ALLEGRO_WINDOWS enclosing that area of code that handles what to do if MAX_PATH should be used instead.

All I had to do was change PATH_MAX to MAX_PATH and it compiled successfully.

In the end
5.0.10 = Successfully built
5.1.11 = Failed to build because 'IZoneIdentifier': base class undefined

Peter Hull
Member #1,136
March 2001

I believe the root cause is the first error; PATH_MAX is not defined anywhere.

It was the opposite problem a while ago:
https://www.allegro.cc/forums/thread/613716

I wonder if something is different in the 64-bit headers?

Pete

ZenRowe
Member #16,081
September 2015

Looking at that thread it looks like it should be MAX_PATH instead of PATH_MAX for windows, I may be misunderstanding.

I just attempted to compile using the unstable build 5.1.11 and I get a different result

52 occurrences of

#SelectExpand
1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um\winapifamily.h(26): fatal error C1083: Cannot open include file: 'winpackagefamily.h': No such file or directory [C:\universal\build_msvc_64\allegro\allegro.vcxproj]

the error seems to pop with every single allegro header...

I did find this header "winapifamily.h", only it's not in
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um\
it's in
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\shared\

><

Peter Hull
Member #1,136
March 2001

I tried with VS 2015 and cmake - making a 32-bit target it compiled without errors. Maybe can you try and configure Cmake to used 32-bit instead of 64?
Also, universal apps are new in Win10 and I doubt allegro does the necessary to be a universal app, so avoid any options like that.
Pete

ZenRowe
Member #16,081
September 2015

I don't remember trying to do anything with universal apps...

Oh are you referring to the folder path?

That's just part of the folder hierarchy is SiegeLord's script package that I found here
https://www.allegro.cc/forums/thread/615657

I tried to compile using 32-bit and I am still getting the same errors as before:

#SelectExpand
1"C:\universal\build_msvc_32\allegro\INSTALL.vcxproj" (default target) (1) -> 2"C:\universal\build_msvc_32\allegro\ALL_BUILD.vcxproj" (default target) (2) -> 3"C:\universal\build_msvc_32\allegro\allegro.vcxproj" (default target) (4) -> 4(ClCompile target) -> 5 C:\universal\allegro\src\file_stdio.c(315): error C2065: 'PATH_MAX' : undeclared identifier [C:\universal\build_msvc_32\allegro\allegro.vcxproj] 6 C:\universal\allegro\src\file_stdio.c(315): error C2057: expected constant expression [C:\universal\build_msvc_32\allegro\allegro.vcxproj] 7 C:\universal\allegro\src\file_stdio.c(315): error C2466: cannot allocate an array of constant size 0 [C:\universal\build_msvc_32\allegro\allegro.vcxproj] 8 C:\universal\allegro\src\file_stdio.c(315): error C2133: 'filename' : unknown size [C:\universal\build_msvc_32\allegro\allegro.vcxproj]

Considering you were able to compile, I likely did something wrong. :'(

Peter Hull
Member #1,136
March 2001

OK, I was able to build everything using SiegeLord's scripts. I had to make quite a few mods though - almost all just "" quoting variables so I could use it for paths with spaces in them. I've cloned his repo and I hope to put in a pull request for my changes, for review.

In terms of the toolchain etc. I just omitted the toolchain/generator variables from the batch file and CMake found my installed MSVC automatically.

Note, I haven't actually tested anything yet; I may have just generated a load of random junk but at least it did it without error!

Pete

Go to: