Difference between revisions of "HowTo:VCPP Compiling"

From VsWiki
Jump to: navigation, search
(update vc9)
(update bug GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F)
 
(3 intermediate revisions by the same user not shown)
Line 88: Line 88:
 
http://svn.code.sf.net/p/vegastrike/code/trunk/win32
 
http://svn.code.sf.net/p/vegastrike/code/trunk/win32
  
 +
*5-There will be errors if you try to compile , caused by Boost 1.45 .
 +
( version 0.5.2 of vegastrike contain only boost 1.53 )
 +
So checkout also the Boost 1.45 in the same folder than the 1.53 ( in vegastrike/Boost )
 +
http://svn.code.sf.net/p/vegastrike/code/branches/vegastrike_0_5_1/vegastrike/boost/1_45
 +
 +
*6-There is bug with a #define and GL_TEXTURE_CUBE_MAP_SEAMLESS
 +
Solution is [http://forums.vega-strike.org/viewtopic.php?f=5&t=18590&p=135450#p135450 in the forum ]
 +
   
 
Now your solution vc9 should be ok .
 
Now your solution vc9 should be ok .
 
BUT THE .EXE WILL BE BUILD IN "\trunk\vega-vc9\Release" or "\trunk\vega-vc9\Debug"
 
BUT THE .EXE WILL BE BUILD IN "\trunk\vega-vc9\Release" or "\trunk\vega-vc9\Debug"

Latest revision as of 04:22, 24 February 2014

arrow_left.png Checkout SVN (Ubuntu Linux) arrow_up.png HowTos Cygwin Compiling arrow_right.png

Compiling under Visual C++

First, check out the SVN modules.

When using another module (e.g. vegastrike, vssetup), they should be placed in the directory above vega-vc in the directory tree.

For example, when you want to checkout Vegastrike, you may make a Vegastrike directory and from there, checkout vega-vc9 for all Visual C++ editions, vegastrike, data ALL from this directory.

  • vegastrike/ - base directory.
  • vegastrike/vegastrike/ - The stuff from the vegastrike module (the actual code)
  • vegastrike/vega-proj/ - The project files. (VISUAL C++ 6.x) Deprecated
  • vegastrike/vega-vc7/ - The project files. (VISUAL C++ 7.x) Deprecated
  • vegastrike/vega-vc8/ - The project files. (VISUAL C++ 8.0) Deprecated
  • vegastrike/vega-vc9/ - The project files. (VISUAL C++ 9.0 and higher)
  • vegastrike/win32/ - The newer version of data. Until the change is made in the Vegastrike project setting binaries will be create in vega-vc9/Release or vega-vc9/Debug. Binaries will be compiled into the bin directory, so it should be here in the tree if you do not want to edit project settings.

Here is a list of every project included for SVN compilation that is used:

  • vegastrike (Vegastrike.exe) - VegaStrike binary
  • vsserver (vegaserver.exe) - VegaStrike server
  • vssetup (Setup.exe) - The main Setup program--doesn't change much, so you can use the binary directly from SVN.

Visual C++ 11.x (Visual Studio Express 2012)

FIXME Write Me - Until specific instructions are written by someone knowledgeable, follow information for previous versions and supplement it with up to date information about compiling from the forums.

Visual C++ 10.0 (2010 Express)

FIXME Currently there are no working project files for VC10. This will be changing in the near future so please be patient. For now just copy everything from the trunk/vega-vc9 folder into a newly created vega-vc10 folder and convert the VC9 project files.

You can download a copy of VC10 Express from Download Visual Studio Express. If you encounter any issues post a new topic in the Compiling Problems forum.

Visual C++ 9.0 (2008 Express)

This is likely only for Windows XP SP3 and Vista (so probably not Windows 2000). Apparently no Platform SDK is necessary. Note that it is required that the local file and directory structure is identical to the one on SVN. You need to checkout the following: trunk/vegastrike, trunk/vega-vc9, trunk/win32. If the above is wrong you will need to download the 2008 SDK or higher.

  1. Download Visual C++ 2008 Express Edition.
  2. Make sure you are logged on as admin. Otherwise the VC++ 2008 EE installation will fail. Run the installer, uncheck all the boxes on each page if you want a lighter download. It will do everything on it's own then ask to reboot.
  3. To update for Python 2.7 you will need to download the latest 2.7 source release: Download latest source Python 2.7
      or directly www.python.org/download/releases/2.7.6
  1. Compile Python using their Python-2.7.1\PCbuild\pcbuild.sln solution file. Make sure it works (python.exe starts up).
  2. Substitute the corresponding Python 2.7 files from Python-2.7.1\PCbuild and Python-2.7.1\include. Python also requires a pyconfig.h inside your vega-vc9\include\python, you can copy it from Python-2.7.1\PC.
  3. In VC++ 2008 EE, update the vegastrike project properties: in configuration properties -> linker -> input -> additional dependencies, change the python version to 2.7. (It should be the last one in the list.)
  4. Apply the VCExpress.diff to fix the resource file for use with Visual C++ Express.
  5. Vegastrike should now build normally.


  • Update --Ezee 19:39, 22 February 2014 (UTC)

I had a lot of troubles to compile , link and run the program !

So this is how to obtain a working version of Vegastrike 0.5.2 from the SVN

( with turtoise )

YOU MUST CREATE FIRST THE EMPTY FOLDERS IN YOUR COMPUTER :

The idea is to recreate the tree of the svn .

  • 1_Create a folder trunk
  • 2_Create a folder trunk\win32
  • 3_Create a folder trunk\data
  • 4_Create a folder trunk\vega-vc9
  • 5_Create a folder trunk\vegastrike

from there , you are ready to check out the SVN .

  • 1- Select your folder vega-vc9

Right-click and use tortoise -> checkout with : http://svn.code.sf.net/p/vegastrike/code/trunk/vega-vc9

  • 2- Select your folder vegastrike

Right-click and use tortoise -> checkout with : http://svn.code.sf.net/p/vegastrike/code/trunk/vegastrike

  • 3- Select your folder data

Right-click and use tortoise -> checkout with : http://svn.code.sf.net/p/vegastrike/code/trunk/data

  • 4- Select your folder win32

Right-click and use tortoise -> checkout with : http://svn.code.sf.net/p/vegastrike/code/trunk/win32

  • 5-There will be errors if you try to compile , caused by Boost 1.45 .
( version 0.5.2 of vegastrike contain only boost 1.53 )
So checkout also the Boost 1.45 in the same folder than the 1.53 ( in vegastrike/Boost )
http://svn.code.sf.net/p/vegastrike/code/branches/vegastrike_0_5_1/vegastrike/boost/1_45
  • 6-There is bug with a #define and GL_TEXTURE_CUBE_MAP_SEAMLESS
Solution is in the forum 
   

Now your solution vc9 should be ok . BUT THE .EXE WILL BE BUILD IN "\trunk\vega-vc9\Release" or "\trunk\vega-vc9\Debug" by default .

( you won't be able to run or debug the game , step into etc ... )

So now , go to your project options , in " Linker" , change the output path like this : " D:\program\trunk\win32\bin\$(ProjectName).exe "

( change D:\program\trunk\ by your path  :wink: )

Almost ended .

You need to copy the content of your folder "data" in your folder win32\bin DON'T FORGET TO UNZIP THE PYTHON 2.7 rar in \win32\bin !

GOOD ! Enjoy your new Vegastrike programming environment !

Visual C++ 8.0 (2005 Express)(deprecated)

This is left here in case someone wants to attempt a working VC8 build Warning: VC8 requires a big download off Microsoft's site.

Microsoft claims that they will continue offering their non-expiring version of VC8 forever, so I guess this will be the main build platform.

Keep in mind that VC8 does something weird with .manifest files, and for official builds, I would suggest VC7 as it seems to be faster, and it lacks compatibility issues. There are too many forum threads on this to count.

This will work on Windows 2000 or XP (Not sure about 98,95...).

  1. You have two download choices:
  2. Install the Windows Platform SDK (Instructions - FULL ISO version(395MB)). A more recent SDK for Windows XP SP2 exists, but it has not been tested with VS (yet.)
  3. In Visual C++ 8.0 (2005 Express), under Tools...Options...Visual C++ Directories, add an Include directory for C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include and an Include directory for C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc. If you forget this step, the build will not be able to find windows.h, basetsd.h, and afxres.h and will throw fatal errors.
  4. You should not need the DirectX SDK (337MB) to compile VS, but it may be required to compile OGRE in the future.
  5. Disable Intellisense: Microsoft provides no GUI for this, but it is recommended unless you want to eat up twice the RAM and wait 10-20 seconds between saving each file.
    • Browse to your VC8 install.
    • Go to the VC/vcpackages folders and rename the "feacp" DLL file to anything else like "feacp_backup.dll". This should not break anything... it will only disable IntelliSense.
  6. Checkout the Vegastrike project as described earlier.
  7. Open the "vega-vc8" project using the IDE.
  8. The compilation should go for the most part smoothly. If you encounter any problems, please tell us in the forum or specifically on this thread.
    • Note that Debug versions will be very slow (I get 5 frames/second on my Pentium3 1GHz machine using debug VS).

Visual C++ 8.0(2005 Express) plus the Code::Blocks IDE (deprecated)

You can download Visual C++ 8.0(2005 Express) after you acquired a vcsetup.exe for Visual C++ 8.0. These are still being offered on some download sites. The main advantages of Visual C++ 8.0 over later versions are that it works for older OSes like Windows 2000 and that there is a vegastrike project file for it, which you can check out from svn as vega-vc8. You will also need an SDK, I used the Platform SDK PSDK-x86.exe (1.3 MB) which you can find with the query “Windows Server 2003 Platform SDK Web” in a search engine. You will need to enable internet explorer for a minute as the default browser to install the PSDK. Also try to get the vcredist_x86.exe for Visual C++ 8.0(2005 Express) if you want to share your vegastrike binary with others. You can acquire the code::block development environment from www.codeblocks.org.


You might want to make a copy of your SVN checkout tree now, to have a clean copy just in case of the code in VegaStrike/ and the project files in vega-vc8/ Start code::blocks, choose VC2005/2008 as default tool chain and import the .sln solution file from vega-vc8 into a workspace. Use the vc8 2005/2008 compiler. Double click the vegastrike project so that it is selected in bold. Go to Project/Build options and add /EHsc to vegastrike in other compiler options, remove /W from all projects and choose a warning level you like instead for each compiling option, like /W1 for release and /W3 for a debug build. I have only tried the Win32 and Win32 debug buildsYou will notice that the debug build sets other libraries in linker settings. Basically the left side of the settings is used to include libraries while the right side is used to NOT include the default libraries. Some people have reported that they need to add "/NODEFAULTLIB:libcmt" manually there to exclude libcmt from being linked which results in a conflict.(I also removed /ZI and added insted on the left side /Zi /D_DEBUG to have debug symbols, I'm not sure which is better).


You need to edit the file Resources.rc to read

#include <WinResrc.h>

instead of

#include "afxres.h"


If you should discover a problem with the PNG or Python libraries, or simply want to try out newer ones, recall that each of these libraries/dlls needs to be one built with the same compiler you use for vegastrike. Be warned that for libpng-1.2.34 the optimized build does not work, while the debug build(without any optimization) works with the vc8 compiler.


You can also choose where the binaries you produced end up, but I left it to default settings which is in the ../win32/bin directory, thats right aside ../VegaStrike. Finally I took the executable, which is named vegastrikeR.exe for the release version, and all other files produced and placed them into the directory structure of an old VegaStrike install. Running vegaStrike produced errors, which meant I had to resolve them by checking out the directories bases,mission,programs,sounds/missions,techniques and textures directories from SVN using the repository browser. (I think you can even do without some of these.) Copying the directories into and over the directory tree of the old install produced a working binary. At least it works as far as I know - I didn't get to test much yet.


You can debug programs in the VC++ IDE by creating a new project and adding an executable as a subproject.


Enjoy!

Visual Studio 7.x (deprecated)

Compiling from the command line with Visual Studio

Here is a batch file that could be used to checkout everything and then compile all projects (copy and paste in makeall.bat), if you were going somewhere for a few hours and wanted to get a working project when you got back:

@echo off
mkdir vegastrike
cd vegastrike
svn co https://vegastrike.svn.sourceforge.net/svnroot/vegastrike/trunk/vega-vc7
svn co https://vegastrike.svn.sourceforge.net/svnroot/vegastrike/trunk/vegastrike
svn co https://vegastrike.svn.sourceforge.net/svnroot/vegastrike/trunk/
cd vega-vc7
echo Building project...
"C:\VC7\Common7\IDE\devenv.exe" vegastrike.sln /BUILD Debug
cd ..
cd ..

NOTE: You must replace the "C:\vc7" with the directory where you installed visual c++ 7 and replace the "Debug" on the same line with "Release" if you want a release build.

Compiling with the Visual Studio GUI (deprecated)

(This is written with Visual C++ .NET Standard in mind)

Once you have checked out the vegastrike and vega-vc7 modules from CVS, use Visual Studio to open vegastrike.sln, found in the vega-vc7 directory. When compiling for release, select "Release Boost 131" from the drop-down menu on the toolbar. Right-click on the "vegastrike" project in the "solution explorer" sidebar, and then select "Build".

Visual C++ Toolkit 2003

This is a free download from Microsoft, and is the same compiler and linker as Visual Studio 2003.

Note, you must have Windows XP or 2000 in order to install the toolkit. (formerly said only Windows XP, but this is not true according to their download page)

Downloads


Configuring Code::Blocks

  • Run CodeBlocks. The first time you install it, you will be listed with a set of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default.
  • For configuration you have to include the location of the Windows Platform SDK. Go to Settings -> Compiler in the menu. Click the Directories tab. Add the directory "C:\Program Files\Microsoft SDK\bin" to the Resource Compiler tab.

Compiling with Code::Blocks and Visual C++ Toolkit

Once you have checked out the vegastrike and vega-vc7 modules from CVS, import the vegastrike.sln file, found in the vega-vc7 directory into Code::Blocks using Project->Import->MS Visual Studio Solution in the menu.

Note (CVS version as of 14 Nov 2005

Using the most recent CVS versions (and 2003/Runtime versions from Microsoft) I had to remove /W from the build options Project Build Options > Compiler Options > Other Options

Visual C++ 6.0 (deprecated)

As of the end of December, 2005, VegaStrike has dropped compatibility for VC 6 because of the new OGRE rendering engine.

VC 6 users can grab a free copy of VC 8 (Visual Studio 2005 Express) off the Microsoft site, and follow the directions below to compile.

Compiling using VC 6

Until the OGRE port is finished, VC 6 will still compile, so you can try it if VC8 won't work for you.

First, check out all the modules above.

Then from the MSDEV IDE, open the "vegastrike.dsw" project inside vega-proj, and compile. You will want to use Debug or Release configurations for a standard build. (The Boost 129 builds are permanently broken, and GLUT doesn't work very well as far as I know)

See Also


arrow_left.png Checkout SVN arrow_up.png HowTos Cygwin Compiling arrow_right.png