Visual Studio Express is a free compiler suite available from Microsoft.
These instructions describe using the suite under Windows. Note that Visual
Studio Express is not supported by Wine. Developers needing a Microsoft
compiler suite under Wine should try
Visual
Studio 6 under Wine.
Installation
Configuration
For frequent use , edit the batch script used to set the Windows command line
environment to include the path to the freshly installed SDK. For my
installation I updated PATH, INCLUDE, and LIB to look like:
@set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";%INCLUDE%
@set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib";%LIB
Compilation
cl -DSTANDALONE -D_X86_ -wd4496 test_name.c required_lib01.lib required_lib02.lib ...
Common libs to link in include: ale32.lib, shlw.lib, and bits.lib.
Errors
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(3857) : error C2061: syntax error : identifier 'PCONTEXT'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(3858) : error C2059: syntax error : '}'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(8319) : error C2146: syntax error : missing ')' before identifier 'ContextRecord'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(8319) : error C2061: syntax error : identifier 'ContextRecord'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(8319) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winnt.h(8320) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(779) : error C2061: syntax error : identifier 'LPCONTEXT'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(779) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(781) : error C2061: syntax error : identifier 'LPEXCEPTION_POINTERS'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(781) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3155) : error C2146: syntax error : missing ')' before identifier 'lpContex t'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3155) : error C2081: 'LPCONTEXT' : name in formal parameter list illegal
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3155) : error C2061: syntax error : identifier 'lpContext'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3155) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3156) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3163) : error C2143: syntax error : missing ')' before '*'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3163) : error C2143: syntax error : missing '{' before '*'
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\winbase.h(3164) : error C2059: syntax error : ')'
Add -D_X86 to your build.
Environment Variables
Sadly, the shell provided by Windows is not Bash. Environment variables are
accessed using the %var% syntax. For example, updating the include path
used by your compiler would take the form:
set INCLUDE="path_to_include";%INCLUDE%
A handy path to include for development is the bin directory of the SDK:
set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin"
Compilation Problems
Unresolved symbols are a good sign of missing libraries. Documentation for
the function at MSDN includes the required libraries under the "Requirements"
listing.
Registry
You really should not manually edit the registry to remove a service. Rather
use a tool such as svcconfig (MSDN example of a service configuration program)
for this task. Trust me.