Difference between revisions of "HowTo:VCPP Compiling"
m (→Visual C++ 8.0(2005 Express) plus the Code::Blocks IDE) |
m (→Visual C++ 8.0(2005 Express) plus the Code::Blocks IDE) |
||
Line 106: | Line 106: | ||
− | You can debug programs in the VC++ IDE by creating a new project and adding | + | You can debug programs in the VC++ IDE by creating a new project and adding an executable as a subproject. |
Revision as of 21:09, 5 February 2009
Checkout SVN (Ubuntu Linux) | HowTos | Cygwin Compiling |
Contents
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-proj
in the directory tree.
For example, when you want to checkout Vegastrike, you may make a Vegastrike
directory and from there, checkout vega-proj
(or vega-vc7
for "dot-NET" or vega-vc8
for Express users), 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) -
vegastrike/vega-vc7/
- The project files. (VISUAL C++ 7.x) -
vegastrike/vega-vc8/
- The project files. (VISUAL C++ 8.0) -
vegastrike/win32/
- The newer version of data. 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++ 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)
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-vc8
, trunk/win32
.
- Download Visual C++ 2008 Express Edition.
- 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.
- To successfully compile Vegastrike on the VC++ 2008 EE we need a new version of Python. Version 2.6.1 seems to work; you can download the Python 2.6.1 source here.
- Compile Python using their
Python-2.6.1\PCbuild\pcbuild.sln
solution file. Make sure it works (python.exe
starts up). - Backup and stash away the following: all the Python 2.2/2.4/2.5 libraries and dll's in
win32\bin
,vega-vc8\lib
and the headers invega-vc8\include\python
. - Substitute the corresponding Python 2.6 files from
Python-2.6.1\PCbuild
andPython-2.6.1\include
. Python also requires apyconfig.h
inside yourvega-vc8\include\python
, you can copy it fromPython-2.6.1\PC
. - In VC++ 2008 EE, update the vegastrike project properties: in configuration properties -> linker -> input -> additional dependencies, change the python version to 2.6. (It should be the last one in the list.)
- Vegastrike should now build normally.
Visual C++ 8.0 (2005 Express)
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...).
- You have two download choices:
- Download the standard install: http://msdn.microsoft.com/vstudio/express/visualc/download/ and register (free but requires an E-mail and filling in a form)
- Download the "manual install" (from a CD image): http://msdn.microsoft.com/vstudio/express/support/install/ (seems to be an ISO image, but looks like it doesn't require registration...)
- 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.)
- 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.
- You should not need the DirectX SDK (337MB) to compile VS, but it may be required to compile OGRE in the future.
- 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.
- Checkout the Vegastrike project as described earlier.
- Open the "vega-vc8" project using the IDE.
- 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
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
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
(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
- Install the Visual C++ Toolkit 2003 from the Microsoft web site.
- Install the Windows Platform SDK from the Microsoft web site. You can take any of the 3 versions available.
- Install the Code::Blocks (alternative download site on Sourceforge). You can take the full version or the core only, since we will use the VS 2003 TK.
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
See Also
Checkout SVN | HowTos | Cygwin Compiling |