User:Robin Cornelius/viewer-development VC2005 Express

From Second Life Wiki
Jump to navigation Jump to search

Visual C++ 2005 Express lacks a few features that LL rely on to sucessfully compile and package the viewer, but they are fairly easy to work around.

Update express to Service Pack 1 ATL Security Update

It is important that you have the 4053 version of the VC80 CRT installed, for Express editions this means installing http://www.microsoft.com/downloads/details.aspx?FamilyID=7c8729dc-06a2-4538-a90d-ff9464dc0197&displaylang=en

Compile against the correct VC80 4053 CRT

The previous patch does not appear to correctly update the default CRT that programs built with 2005 Express link against, to correct this behaviour edit C:\Program Files\Microsoft Visual Studio 8\VC\include\crtassem.h and change

#ifndef _CRT_ASSEMBLY_VERSION
#if defined _USE_RTM_VERSION
#define _CRT_ASSEMBLY_VERSION "8.0.50608.0"
#else
#define _CRT_ASSEMBLY_VERSION "8.0.50727.762"
#endif
#endif

to

#ifndef _CRT_ASSEMBLY_VERSION
#if defined _USE_RTM_VERSION
#define _CRT_ASSEMBLY_VERSION "8.0.50608.0"
#else
#define _CRT_ASSEMBLY_VERSION "8.0.50727.4053"
#endif
#endif

winres.h

This file is not present with Visual Studio 2005 express due to it mainly being an MFC header (MFC is not included with express), the actual requirments of this file are very low, it basicly needs to include windows.h and define IDC_STATIC. Edit.. It is found on some SDK installs as part of the examples, but regardless just creating it as follows solves issues.

Recommended work around is to create your own winres.h, in the Visual Studio system include location, so you always have it for all builds.

on a 32bit system - C:\Program Files\Microsoft Visual Studio 8\VC\include\winres.h on a 64bit system - C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\winres.g

#ifndef _WINRES_H
#define _WINRES_H

#include "windows.h"
#ifndef IDC_STATIC
#define IDC_STATIC 1000
#endif

#endif

Stage the CRT dlls

Due to differences in the registry entrys between express and full editions, it is not possible to get the location of the CRT dlls directly from the registry entries for Visual C++ (also with express no licence is given to reistribute the runtimes). The correct redistrbutal package can be obtained from http://www.microsoft.com/downloads/details.aspx?familyid=766a6af7-ec73-40ff-b072-9112bab119c2&displaylang=en , after obtaining this setup.exe, openit using 7 Zip, WinRaR or some other program capable of opening this kind of compressed self extracting archive.