Skip to content

Compiling under Windows (Visual Studio 2010)

Adrian Hernando edited this page Oct 12, 2023 · 9 revisions

Compiling with VisualCpp - OTHire 0.0.3

  • Compiling tutorial for Windows using Microsoft Visual C++ - A modified Open Tibia Server for the tibia 7.72
  1. You need Visual C++ 2010 Express Edition - https://mega.nz/file/bQVQ1BoJ#KPZ6VyWeeoqmA1c0mlMNsbIxBNmhkOVwbom-58RLrwA
  2. Download Avesta libraries - https://github.com/peonso/tibialegacyserver/raw/master/docs/libraries.7z

Steps

  1. Download source code
  • Create new project

  • click File -> New -> Project...

  • select Visual C++ -> General -> Empty Project

  • set 'Name' for your project (I'll name it "server")

  • set 'Location' for your project (It's "D:\projects" for me)

  • leave 'Solution name' same as 'Name' ("server")

  • 'Create directory' for solution should be checked

  1. Adding files
  • go to 'Location\Name\Solution name' of your project (D:\projects\server\server), and copy there all content of source folder
  • in Solution Explorer right click on Header Files -> Add -> Existing item..., right click on Sort by -> Type, select all header files (.h extension), don't forget about the msvc.h and workarounds.h (from 'compiler' folder)
  • in Solution Explorer right click on Source Files -> Add -> Existing Item..., select all source files (.cpp extension)
  1. Setting project up
  • go to (in menubar) Project -> Properties
  • in the top left corner, set Configuration to 'Release'
  • in tree widget on the left, go to Configuration Properties (you should be there anyway)
    • General, Platform Toolset should be 'v100', Character Set should be 'Use Multi-Byte Character Set ' , rest leave as default
    • C/C++
      • General
        • click Additional Include Directories, drop down button shall appear, click on it, and in new window add following directories:
          • libraries\inc\boost
          • libraries\inc\libiconv
          • libraries\inc\libxml
          • libraries\inc\lua
          • libraries\inc\mpir
          • libraries\inc\mysql
          • libraries\inc\sqlite
        • Multi-processor compilation (optional), you can set it to 'Yes', that will speed compilation
      • Preprocessor
        • Preprocessor definitions, click on it, choose edit, and add:
          • __USE_OTPCH__
          • __USE_MYSQL__
          • __SKULLSYSTEM__
          • __OLD_GUILD_SYSTEM__
          • __GUILDWARSLUARELOAD__
          • __ENABLE_SERVER_DIAGNOSTIC__
      • Precompiled Headers
        • set Precompiled Header to 'Use'
        • set Precompiled Header File to 'otpch.h'
    • Linker
      • General
        • Additional Library Directories, click dropdown button, edit and add:
          • libraries\lib (entire path, as exemple D:\otserv\projects\libraries\lib)
      • Input
        • Additional Dependencies, click dropdown button, edit and add:
          • libmysql.lib
          • libxml2.lib
          • lua5.1.lib
          • mpir.lib
          • sqlite3.lib
          • dbghelp.lib
  • we are done here, press Ok
  • in Solution Explorer -> Source Files, right click on otpch.cpp -> Properties
    • make sure Configuration (top left) is 'Release'
    • go to Configuration Properties -> C/C++ -> Precompiled Headers
      • set Precompiled Header to 'Create'
      • set Precompiled Header File to 'otpch.h'
      • press Ok
  1. Compilation
  • in the toolbar (top center) change configuration from 'Debug' to 'Release'
  • click Build -> Build Solution
  • executable will be in Location\Name\Release (D:\projects\server\Release)