• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling TFS 1.3 vcpkg windows

Itutorial

Excellent OT User
Joined
Dec 23, 2014
Messages
2,307
Solutions
68
Reaction score
982
1) Install Visual Studio 2017 (make sure you include c++ it doesn't come preincluded)

Open windows powershell

Code:
cd C:\
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install

For 64bit compiling
Code:
.\vcpkg install boost-iostreams:x64-windows boost-asio:x64-windows boost-system:x64-windows boost-filesystem:x64-windows boost-variant:x64-windows boost-lockfree:x64-windows luajit:x64-windows libmariadb:x64-windows pugixml:x64-windows mpir:x64-windows cryptopp:x64-windows

for 32bit compiling
Code:
.\vcpkg install boost-iostreams:x86-windows boost-asio:x86-windows boost-system:x86-windows boost-filesystem:x86-windows boost-variant:x86-windows boost-lockfree:x86-windows luajit:x86-windows libmariadb:x86-windows pugixml:x86-windows mpir:x86-windows cryptopp:x86-windows

Keep in mind this step takes a long time and it may seem like the powershell freezes. Just wait it out.

Open your TFS.vcxproj

Additional Includes
Code:
C:\vcpkg

Additional libraries
Code:
C:\vcpkg

Wait for files to parse then rebuild. That should be it.


If you get an error for lua.hpp

download TFS-SDK3.2

add include to visual studio
Code:
C:\pathTo\TFS-SDK3.2\luaJIT\include

add to libraries
Code:
C:\pathTo\TFS-SDK3.2\luaJIT\lib(or lib64)
 
Last edited:
Im afraid this one is out of my scope of knowledge. If there is no answer by tomorrow I will see what I can dig up.
 
@Delusion It's the only error showing up. There are no warnings, too. x.x

Include path:
$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Users\myuser\Desktop\forgottenserver-master\tfs-sdk-3.2\LuaJIT\include;C:\Users\myuser\vcpkg;

Libraries path:
$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;C:\Users\myuser\Desktop\forgottenserver-master\tfs-sdk-3.2\LuaJIT\lib64;C:\Users\myuser\vcpkg;

Edit: Actually, there was a warning, as seen in the screenshot, but it's gone (?).
1570590198821.png
 

Attachments

Last edited:
Are you compiling x64 Release? Also make sure you're using VS2017, not VS2019, there could be incompatibilities with the compiler or it's defaulting to a newer C++ language standard.
Also don't do what he says and don't manually add the SDK, there's a reason it was removed. If you get errors with compiling with lua.hpp, change #include <lua.hpp> to #include <luajit/lua.hpp> (configmanager.cpp, luascript.h) since vcpkg installs it into its own folder.
 
Are you compiling x64 Release? Also make sure you're using VS2017, not VS2019, there could be incompatibilities with the compiler or it's defaulting to a newer C++ language standard.

@Delusion Yes, x64. I was using 2017, but I could only download MSVC v142 for 2019.

I'll try again, brb. :)

Edit: Please ignore the comment on the MSVC version. That was a mess of my own. :p
 
Last edited:
Update

@Delusion
  • Used VS Community 2017
  • Installed the exact Windows SDK version needed as per the VS project file (10.0.17134.0)
  • Downloaded and compiled every package as specified on the repo wiki with vcpkg
  • Updated Include and Libraries directories with vcpkg folder
  • Changed the lua includes in both configmanager.cpp, luascript.h
Good news: The errors are gone!
Bad news: A lot of new errors showed up! Hehe.

1>------ Build started: Project: theforgottenserver, Configuration: Release x64 ------
1>otpch.cpp
1>actions.cpp
1>ban.cpp
1>baseevents.cpp
1>bed.cpp
1>chat.cpp
1>combat.cpp
1>condition.cpp
1>configmanager.cpp
1>connection.cpp
1>container.cpp
1>creature.cpp
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\detail\forced_return.hpp(40): warning C4459: declaration of 'dummy' hides global declaration (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\desktop\forgottenserver-master\src\configmanager.cpp(190): note: see declaration of 'dummy'
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\detail\visitation_impl.hpp(162): note: see reference to function template instantiation 'T boost::detail::variant::forced_return<result_type>(void)' being compiled
1> with
1> [
1> T=result_type
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\detail\visitation_impl.hpp(231): note: see reference to function template instantiation 'void boost::detail::variant::visitation_impl_invoke<Visitor,VoidPtrCV,NoBackupFlag>(int,Visitor &,VoidPtrCV,boost::detail::variant::apply_visitor_unrolled *,NBF,long)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer,
1> VoidPtrCV=void *,
1> NoBackupFlag=boost::variant<boost::blank,std::string,int64_t,double,bool>::has_fallback_type_,
1> NBF=boost::variant<boost::blank,std::string,int64_t,double,bool>::has_fallback_type_
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(2339): note: see reference to function template instantiation 'void boost::detail::variant::visitation_impl<first_which,first_step,Visitor,VoidPtrCV,boost::variant<boost::blank,std::string,int64_t,double,bool>::has_fallback_type_>(const int,const int,Visitor &,VoidPtrCV,boost::mpl::false_,NoBackupFlag,Which *,step0 *)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer,
1> VoidPtrCV=void *,
1> NoBackupFlag=boost::variant<boost::blank,std::string,int64_t,double,bool>::has_fallback_type_,
1> Which=first_which,
1> step0=first_step
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(2348): note: see reference to function template instantiation 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::internal_apply_visitor_impl<Visitor,void*>(int,int,Visitor &,VoidPtrCV)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer,
1> VoidPtrCV=void *
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(2346): note: see reference to function template instantiation 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::internal_apply_visitor_impl<Visitor,void*>(int,int,Visitor &,VoidPtrCV)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer,
1> VoidPtrCV=void *
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(1365): note: see reference to function template instantiation 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::internal_apply_visitor<boost::detail::variant::destroyer>(Visitor &)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(1365): note: see reference to function template instantiation 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::internal_apply_visitor<boost::detail::variant::destroyer>(Visitor &)' being compiled
1> with
1> [
1> Visitor=boost::detail::variant::destroyer
1> ] (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(1363): note: while compiling class template member function 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::destroy_content(void) noexcept' (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\vcpkg\installed\x64-windows\include\boost\variant\variant.hpp(1372): note: see reference to function template instantiation 'void boost::variant<boost::blank,std::string,int64_t,double,bool>::destroy_content(void) noexcept' being compiled (compiling source file ..\src\configmanager.cpp)
1>c:\users\foxro\desktop\forgottenserver-master\src\item.h(218): note: see reference to class template instantiation 'boost::variant<boost::blank,std::string,int64_t,double,bool>' being compiled (compiling source file ..\src\configmanager.cpp)
1>creatureevent.cpp
1>cylinder.cpp
1>database.cpp
1>databasemanager.cpp
1>databasetasks.cpp
1>depotchest.cpp
1>depotlocker.cpp
1>events.cpp
1>fileloader.cpp
1>game.cpp
1>globalevent.cpp
1>groups.cpp
1>guild.cpp
1>house.cpp
1>housetile.cpp
1>inbox.cpp
1>ioguild.cpp
1>iologindata.cpp
1>iomap.cpp
1>iomapserialize.cpp
1>iomarket.cpp
1>item.cpp
1>items.cpp
1>luascript.cpp
1>mailbox.cpp
1>map.cpp
1>monster.cpp
1>monsters.cpp
1>mounts.cpp
1>movement.cpp
1>networkmessage.cpp
1>npc.cpp
1>otserv.cpp
1>outfit.cpp
1>outputmessage.cpp
1>party.cpp
1>player.cpp
1>position.cpp
1>protocol.cpp
1>protocolgame.cpp
1>protocollogin.cpp
1>protocolold.cpp
1>quests.cpp
1>raids.cpp
1>rsa.cpp
1>scheduler.cpp
1>script.cpp
1>scriptmanager.cpp
1>server.cpp
1>signals.cpp
1>spawn.cpp
1>spells.cpp
1>protocolstatus.cpp
1>talkaction.cpp
1>tasks.cpp
1>teleport.cpp
1>thing.cpp
1>tile.cpp
1>tools.cpp
1>trashholder.cpp
1>vocation.cpp
1>waitlist.cpp
1>weapons.cpp
1>wildcardtree.cpp
1>xtea.cpp
1>cryptopp-static.lib(ec2n.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(ecp.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(hex.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(rng.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(modes.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(gfpcrypt.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(hmac.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(gf2n.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(oaep.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(mqueue.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(rijndael.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(hrtimer.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(dll.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(nbtheory.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(pubkey.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(iterhash.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(base64.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(randpool.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(osrng.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(algparam.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(misc.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(cryptlib.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(filters.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(basecode.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(integer.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(queue.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(asn.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(rsa.cpp.obj) : error LNK2001: unresolved external symbol __CxxFrameHandler4
1>cryptopp-static.lib(ecp.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(hex.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(rng.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(gfpcrypt.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(hmac.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(gf2n.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(ec2n.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(mqueue.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(rijndael.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(hrtimer.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(modes.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(dll.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(nbtheory.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(pubkey.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(iterhash.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(base64.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(randpool.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(osrng.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(algparam.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(misc.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(cryptlib.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(filters.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(basecode.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(integer.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(queue.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(asn.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>cryptopp-static.lib(rsa.cpp.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4
1>C:\Users\foxro\Desktop\forgottenserver-master\vc14\x64\Release\theforgottenserver-x64.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "theforgottenserver.vcxproj" -- FAILED.
 
Is anyone able to compile from Windows 10? Please send me a message.
 
Is anyone able to compile from Windows 10? Please send me a message.
Yeah, I did. I used the SKD v10.0.18362.0 and the toolset v141.
After that, I had to include some files from the tfs-sdk manually and installed the vcpkg using the git bash tool.

Server up and running.

Edit: If you need help with windows, just PM me.
 
Last edited:
Yeah, I did. I used the SKD v10.0.18362.0 and the toolset v141.
After that, I had to include some files from the tfs-sdk manually and installed the vcpkg using the git bash tool.

Server up and running.
@Piquenoelmal Gratz! I'm still puzzled by how mysterious this process is hehehe. :p
Some people say the versions are unimportant, others that we shouldn't use the TFS SDK... And I can't even object, because each of these different approaches work.
I was able to compile and debug it using WSL, but the IDE keeps linting includes...
It does so because it's unable to access the WSL filesystem directly.
That shouldn't be a problem though. VS automatically zips all the headers on the remote and download them to local...
The only solution for the inaccurate linting is using vcpkg to also install the packages locally.
I've been trying to sort this out for days. Getting cuckoo already 🤪
 
Is anyone able to compile from Windows 10? Please send me a message.
I can make a video tutorial if you would like, I'll post it up on Otland as a new post.
Just want to make sure ppl needs it and I'll lend a hand.
 
Yeah, I really don't like to use VS. I tried with the CLion IDE, but it didn't work at all.

I'm pretty sure that the SDK, Version and VCPKG(x32 or x64) matters.

Also, the problem that you post here, the alloc problem, was fixed in my case setting SKD v10.0.18362.0 and the toolset v141. The problems with the include or lib were solved after I manually set the include/lib on the project.

To do that, you can:
  • Open your .vcxproj
  • Now, you will have to get the tfs-sdk files. Extract them somewhere
  • When your VS is open, right click "TheForgottenTibiaServer", it will open a menu. Go to Properties. (You can alt+enter as well)
  • After that, go to VC++ Directories, it will open a menu with some fields. Find the "Include directories" and "Library directories"
  • In the "Include directories", double clicked it, click in the dropdown and click edit.
  • Now, go to the tfs-sdk\LuaJIT\include. Use this folder.
  • Now, in the "Library directories", do the same as in the include and use the LuaJIT folder (tfs-sdk\LuaJIT)
  • Apply your changes and click ok
That was how I set everything and everything is ok now.
 
Thank you, guys! 😊

@Piquenoelmal
I'll try that approach one more time and see how it goes. Last time I did something similar, the compiler started to throw errors related to the cryptopp lib (which was just fine [???]). I even used the exact W10 SDK and MSVC versions the project file originally asks for. D:
Maybe with a different SDK it works. That's valuable information, actually! The exact versions are the secret sauce, apparently.
Someone should change these files and push it to master :p

@Klonera
I think there should be more content being produced around TFS source. So please, make the video! We need to lower the barrier a bit... The environment setup is just a little bit too much :b
 
Thank you, guys! 😊

@Piquenoelmal
I'll try that approach one more time and see how it goes. Last time I did something similar, the compiler started to throw errors related to the cryptopp lib (which was just fine [???]). I even used the exact W10 SDK and MSVC versions the project file originally asks for. D:
Maybe with a different SDK it works. That's valuable information, actually! The exact versions are the secret sauce, apparently.
Someone should change these files and push it to master :p

@Klonera
I think there should be more content being produced around TFS source. So please, make the video! We need to lower the barrier a bit... The environment setup is just a little bit too much :b

Cryptopp lib, and another lib's missing problem, happens when you try to compile with the wrong version of vcpkg. Always remember to set to release and x32 or x64.
Still, if you can't compile even with the right options, try to set the lib manually as I described with the LuaJIT.
 
When I install the libraries by executing the following in PowerShell:
'.\vcpkg install boost-iostreams:x86-windows boost-asio:x86-windows boost-system:x86-windows boost-filesystem:x86-windows boost-variant:x86-windows boost-lockfree:x86-windows luajit:x86-windows libmariadb:x86-windows pugixml:x86-windows mpir:x86-windows cryptopp:x86-windows', PowerShell concludes with:
1579035759298.png

When I opend theforgottenserver.vcxproj in Visual Studio 2017 Community version 15.9, I first did a retarget solution with Windows SDK Version 10.0.17763.0. Then I tried to compile a release Win32. A Theforgottenserver-win32.exe will be generated. However the following exception handler will be raised:
1579036412035.png

A remark is that on the debug log lot's of .dll files can't be loaded, because it cannot find or open the PDB file.

Can anybody tell me what to do?
 
When I install the libraries by executing the following in PowerShell:
'.\vcpkg install boost-iostreams:x86-windows boost-asio:x86-windows boost-system:x86-windows boost-filesystem:x86-windows boost-variant:x86-windows boost-lockfree:x86-windows luajit:x86-windows libmariadb:x86-windows pugixml:x86-windows mpir:x86-windows cryptopp:x86-windows', PowerShell concludes with:
View attachment 41725

When I opend theforgottenserver.vcxproj in Visual Studio 2017 Community version 15.9, I first did a retarget solution with Windows SDK Version 10.0.17763.0. Then I tried to compile a release Win32. A Theforgottenserver-win32.exe will be generated. However the following exception handler will be raised:
View attachment 41726

A remark is that on the debug log lot's of .dll files can't be loaded, because it cannot find or open the PDB file.

Can anybody tell me what to do?
 
Back
Top