Difference between revisions of "Compiling with Microsoft Visual C++ (OpenXcom)"

From UFOpaedia
Jump to navigation Jump to search
Line 1: Line 1:
== Getting the source ==
+
==Windows==
 +
===Setting up===
 +
# Download [https://windows.github.com/ GitHub for Windows].
 +
# Download the source code from [https://github.com/SupSuper/OpenXcom here], by pushing '''Clone in Desktop'''.
  
You will need a Windows Git client to grab the latest source code.
+
===Compiling===
 
+
# Download and install Visual Studio. A free version is available [http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx here].
=== TortoiseGit ===
+
# Download the following dependencies for the appropiate version of Visual Studio.
 
 
# Install [http://msysgit.github.io/ Git for Windows]. When asked, select '''Use Git Bash only''', '''Use OpenSSH''' and '''Checkout Windows-style, commit Unix-style line endings'''.
 
# Install [http://code.google.com/p/tortoisegit/ TortoiseGit]. Restart the computer if asked.
 
# Configure TortoiseGit by right-clicking any folder and selecting '''TortoiseGit > Settings'''. Select '''Git > Config''', fill out your '''Username''' and '''E-mail''' as will be displayed in your commits, and make sure '''AutoCrlf''' and '''SafeCrlf''' are checked.
 
# Go to the folder where you wanna put the code, right-click on it and select '''Git Clone'''.
 
# Fill out the '''Url''' to the repository (the official one or your own fork), check the '''Directory''' is correct and press '''OK'''. Better get a drink, it's gonna be a while.
 
# In the future, you can stay up to date by right-clicking your folder and selecting '''Git Sync''' to '''Pull''' the latest code.
 
 
 
== Installing dependencies ==
 
 
 
Put the required library files in a '''deps''' folder inside the codebase folder (above the '''src''' folder) with the following structure:
 
* '''deps\include\SDL''' - SDL headers
 
* '''deps\include\yaml-cpp''' - yaml-cpp headers
 
* '''deps\lib\Win32''' - library x86 DLL and LIB files
 
* '''deps\lib\x64''' - library x64 DLL and LIB files
 
 
 
Alternatively, you can grab the pre-compiled dependencies with all the files already in place, and extract it to your codebase folder. Here are the versions available:
 
 
* [http://openxcom.org/download/dev/openxcom-deps-win-vc2010.zip Visual C++ 2010]
 
* [http://openxcom.org/download/dev/openxcom-deps-win-vc2010.zip Visual C++ 2010]
 
* [http://openxcom.org/download/dev/openxcom-deps-win-vc2013.zip Visual C++ 2013]
 
* [http://openxcom.org/download/dev/openxcom-deps-win-vc2013.zip Visual C++ 2013]
 +
# Extract the files to '''<path-to-repo>\OpenXcom\'''
 +
# Navigate to  '''<path-to-repo>\OpenXcom\src''' and open '''OpenXcom.2010.sln'''.
 +
<!-- Upgrade the solution on later versions of Visual Studio by right clicking on '''OpenXcom'''. idk how to word this -->
 +
# Compile and run the project by pressing the '''Start Debugging''' button with a green arrow on the top toolbar.
  
== Compiling and running ==
+
* Certain anti-viruses such as Avast may stop the project from building. Add the OpenXcom folder as an expection.  
 
+
* See the [http://msdn.microsoft.com/library/dd831853.aspx Visual Studio Documentation] for more information on the IDE.
# Install Microsoft Visual C++ (part of Visual Studio). If you don't have it, you can get the [http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx Express Edition] for free.
 
# Go to the '''src''' subfolder inside your codebase folder and open '''OpenXcom.2010.sln''' for VC++ 2010 and later. If you have an older version you will have to make your own VC++ project.
 
# Compile and run the project by pressing the '''Start Debugging''' button with a green arrow on the top toolbar.
 
# See the [http://msdn.microsoft.com/library/dd831853.aspx Visual Studio Documentation] for more information on the IDE.
 
  
 
== FAQ ==
 
== FAQ ==

Revision as of 15:32, 28 May 2015

Windows

Setting up

  1. Download GitHub for Windows.
  2. Download the source code from here, by pushing Clone in Desktop.

Compiling

  1. Download and install Visual Studio. A free version is available here.
  2. Download the following dependencies for the appropiate version of Visual Studio.
  1. Extract the files to <path-to-repo>\OpenXcom\
  2. Navigate to <path-to-repo>\OpenXcom\src and open OpenXcom.2010.sln.
  3. Compile and run the project by pressing the Start Debugging button with a green arrow on the top toolbar.
  • Certain anti-viruses such as Avast may stop the project from building. Add the OpenXcom folder as an expection.
  • See the Visual Studio Documentation for more information on the IDE.

FAQ

Q: I get a Failed To Load Palette error.
A: Copy the X-Com resources to your bin folder, see Installing for more details.

Q: I get an error about afxres.h not being found.
A: You're using a Visual C++ Express Edition which doesn't support Resource files, just remove resource.h and OpenXcom.rc from the project.

Q: I get an error about MSVCR100.DLL not being found.
A: You're using the pre-built dependencies with an old Visual C++ version so you need to install the VC++ 2010 Redist.

Q: I get a warning about Platform 'x64' cannot be found.
A: You're using a Visual C++ Express Edition which doesn't support x64 builds, but you can still compile for Win32.