Compiling from source with Visual Studio 2019

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
RatchaTowns
Posts: 2
Joined: May 14th, 2020, 7:36 pm

Compiling from source with Visual Studio 2019

Post by RatchaTowns »

Hi, I'm a newbie looking to get into contributing code to Wesnoth for the first time after being a longtime player and lurker. This might not be the right place to put this, and if so, I'm sorry.

I am attempting to use the instructions here to compile the most recent source on Windows.

Try #1: Following instructions exactly:
I forked and cloned the wesnoth repo (to repos/wesnoth on my computer) and then cloned the external repo (to repos/external). I then added external/dll to the system path. I checked out the VC16 branch on the external repo. The wesnoth repo already had a VC16 folder, so I opened the wesnoth.sln in there with Visual Studio 2019. The solution loaded correctly. I then tried to build (configuration Release Win64).

This took almost no time at all and resulted in a lot of repetitions of "...wesnoth\src\boost-patched\bind\arg.hpp(3,10): fatal error C1083: Cannot open include file: 'boost/version.hpp': No such file or directory...". Liblua was the only project that successfully built.

Try #2: Adding paths directly to Visual Studio:
I noticed that the include directories and library directories for each project did not point to external/include and external/lib. So I added those paths to those settings manually and tried to build again (configuration Release Win64).

This approach successfully built an additional project (wesnothlib), but the other three still failed. I ended up getting these errors:
fatal error LNK1104: cannot open file 'libboost_date_time-vc142-mt-x64-1_70.lib'
fatal error LNK1104: cannot open file 'libboost_date_time-vc142-mt-x64-1_70.lib'
fatal error LNK1181: cannot open input file 'libpng16.lib'

As near as I can tell, these files are missing entirely from external/lib. There are close alternatives (libboost_date_time-vc142-mt-x32-1_70.lib and libpng16-16.lib), but no exact matches. I also got a lot of warnings about conversion from size_t to int or unsigned int.


What's happening here? Did I miss a step somewhere? Is my first contribution to the wesnoth project going to be updating these docs? I appreciate any insight you can give me
gfgtdf
General Code Maintainer
Posts: 1344
Joined: February 10th, 2013, 2:25 pm

Re: Compiling from source with Visual Studio 2019

Post by gfgtdf »

Yes these docs seem outdated in particular the " external" tepp is afaik outdated and should no longer be used At least for 1.14 64bit builds, you should remove the external folder and just get everything needed via "vcpkg"
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Pentarctagon
Project Manager
Posts: 4625
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Compiling from source with Visual Studio 2019

Post by Pentarctagon »

I updated the wiki to match the steps we currently are using for the automated travis-ci Windows builds, so barring some oddity cropping up those steps should work for you as well.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
RatchaTowns
Posts: 2
Joined: May 14th, 2020, 7:36 pm

Re: Compiling from source with Visual Studio 2019

Post by RatchaTowns »

Thanks, I'll give it a shot!
Diplounc
Posts: 2
Joined: August 3rd, 2020, 7:48 pm

Re: Compiling from source with Visual Studio 2019

Post by Diplounc »

Hi, with this very helpful information I was able to compile the game on W10 + VS2019, now I'd like to create a windows intaller, so that I can test it on another computer, could you point me to the documentation or explain how to create a windows installer from my compiled version? thanks a lot!
Best,
Jabbakie
Posts: 4
Joined: November 25th, 2020, 12:56 am

Re: Compiling from source with Visual Studio 2019

Post by Jabbakie »

https://wiki.wesnoth.org/CompilingWesno ... ual_Studio this link now dead :-(

Whenever possible, if anyone has a link to some valid instructions on how to compile Wesnoth for VS2019 can they post them here please? I got pretty far on my own, chocking on trying to get some kind of pango.h from somewhere.

1>hash.cpp
1>C:\Work\repos\GitHub\wesnoth\src\hash.cpp(31,10): fatal error C1083: Cannot open include file: 'openssl/sha.h': No such file or directory
1>menu_events.cpp
1>C:\Work\repos\GitHub\wesnoth\src\font\text.hpp(22,10): fatal error C1083: Cannot open include file: 'pango/pango.h': No such file or directory (compiling source file ..\..\src\chat_command_handler.cpp)
1>mouse_events.cpp
1>C:\Work\repos\GitHub\wesnoth\src\build_info.cpp(36,10): fatal error C1083: Cannot open include file: 'SDL2/SDL_mixer.h': No such file or directory
1>playmp_controller.cpp
1>C:\Work\repos\GitHub\wesnoth\src\font\text.hpp(22,10): fatal error C1083: Cannot open include file: 'pango/pango.h': No such file or directory (compiling source file ..\..\src\floating_label.cpp)
1>playsingle_controller.cpp
1>C:\Work\repos\GitHub\wesnoth\src\font\text.hpp(22,10): fatal error C1083: Cannot open include file: 'pango/pango.h': No such file or directory (compiling source file ..\..\src\display.cpp)
Jabbakie
Posts: 4
Joined: November 25th, 2020, 12:56 am

Re: Compiling from source with Visual Studio 2019

Post by Jabbakie »

'twas an awesome chasing pango BTW. Which required glib. Which required libintl.
User avatar
Pentarctagon
Project Manager
Posts: 4625
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Compiling from source with Visual Studio 2019

Post by Pentarctagon »

99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Jabbakie
Posts: 4
Joined: November 25th, 2020, 12:56 am

Re: Compiling from source with Visual Studio 2019

Post by Jabbakie »

That did the trick, @Pentarctagon, thanks a bunch.
Post Reply