[[Microsoft]] [[C]], [[C++]], [[C#]] [[Compiler]] for [[Windows]] [[OS]]

Get a Free and Legal Copy of Microsoft Compiler to develop and test your programs for Windows without quitting Linux.

@ http://rzr.online.fr/q/MSVC

Next goal is to make it fully usable with GNUmake thus by providing scripts that translate gnu standard command lines to DOS ones … feel free to contact me if interessed.

1/ GET IT

The Compiler itself is free (not Libre but it cost nothing) and fully usable under Linux w/ wine

get Microsoft Visual Tool Kit : (free version)

http://msdn.microsoft.com/visualc/vctoolkit2003/

ed2k://|file|VCToolkitSetup.exe|32952488|c534888fa7605403dcb183d2d15282d1|

Then you have compiler/linker (cl.exe) libc and standard includes.

$ ls ~/mnt/msvc2003/bin/
# c1.dll    c2.dll  cl.exe.config  link.exe         msobj71.dll  msvcp71.dll
# c1xx.dll  cl.exe  dbghelp.dll    link.exe.config  mspdb71.dll  msvcr71.dll
$ ls ~/mnt/msvc2003/lib/
# kernel32.lib  libcd.lib  libcmt.lib  libcpd.lib  libcpmt.lib  oldnames.lib
# libc.lib      libcd.pdb  libcp.lib   libcpd.pdb  mscoree.lib

Platform SDK is provided also (see further)

Missing files and workaround :

2/ Msvc on [[Linux]]

Unpack the archive (on Windows )

mv "Microsoft Visual C++ Toolkit 2003" /mnt/c/opt/msvc2003
ln /mnt/c/opt/msvc2003 ${HOME}/mnt/msvc2003

then you can manage with some environement setting (to put in a script, ask me for it)

export MSVC_DIR_GNU="${HOME}/mnt/msvc2003/"
export MSVC_DIR_DOS="Y:\\mnt\\msvc2003\\"
export PATH="${MSVC_DIR_GNU}/bin:${PATH}"
export INCLUDE="${MSVC_DIR_DOS}include"
export LIB="${MSVC_DIR_DOS}lib"
export WINEDLLPATH="${DLL_DIR_GNU}:${MSVC_DIR_GNU}bin:${WINEDLLPATH}"
alias cl="${WINE} ${WINE_OPTS} ${MSVC_DIR_GNU}bin/CL.EXE"
...
cl main.c && wine main.exe # et voila :)

Well to avoid to loose time feel free to improove my wrapper script : http://rzr.online.fr/docs/contribs/bin/cc-msvc.sh (works also w/ vc98)

3/ COMPILE & TEST [[Windows]] applications on [[Linux]] with [[Microsoft]] tools for Free

cat > cmain.c « EOF

#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[[]])
{
#ifdef _MSC_VER
 printf("# _MSC_VER=%d\n",_MSC_VER); // 1310, 1201
#endif
 return(EXIT_SUCCESS);
}

EOF

$ ~/bin/cc-msvc.sh cl cmain.c
$ wine /home/rzr/mnt/msvc2003/bin/CL.EXE cmain.c
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3052 for 80x86
# cmain.c
# Microsoft (R) Incremental Linker Version 7.10.3052
# /out:cmain.exe
# cmain.obj
$ cmain.exe
# _MSC_VER=1310

4/ PLATFORMSDK & USING WINAPI

AS said on : http://www.winprog.org/tutorial/msvc.html

Since this is the .NET SDK, it doesn't come with the headers and libraries required for Win32 API development, as these are part of the Platform SDK. Lo and behold, the Platform SDK is free as well. You only need the Core SDK, but feel free to download the other components as you desire.

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/downlevel.htm

The platform SDK can't be easily got to because it uses ActiveX controls.

Here are some direct links:

http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.bat
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/Extract.exe
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.1.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.*.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.13.cab
ed2k://|file|PSDK-FULL.1.cab|26221140|18832004fd27bb12a12144ab68cd32ca|
ed2k://|file|PSDK-FULL.2.cab|26221140|cc356f4cfb2fc3628efb69f3ba890f8b|
ed2k://|file|PSDK-FULL.13.cab|24343136|e64ef6ab33906f68cd3dd8022746bae8|
ed2k://|file|PSDK-FULL.bat|416|e68abfd97ea840d0841c21a6eee5540a|

note that there are 13 files (of 25Mb each) : PSDK-FULL.1.cab to PSDK-FULL.13.cab, you'll need them all and the two files, PSDK-FULL.bat and Extract.exe in the same directory.

thx baldurk @ http://irc.freenode.net/#winehq

5/ TODO AND GOING FURTHER

  • how to “emulate” gcc command lines ?

is there a script that translate -I… to /I… etc ? then we can use the full GNU suite and w/ msvs

There are some wrappers available:

http://spi.cern.ch/extsoft/packages.php?pkg=msvcwrap

Coin3D used to have a wrapmsvc, of which the exe is still distributed. I found the .cpp in an older distribution (simage-1.2.2 - dir cfg/m4) http://who.is.free.fr/wiki/?MSVCWrap

  • wrap autoconf scripts
  • On Cygwin , I can use nmake from Shell (bash) , but no along GNUmake
$ cat GNUmakefile
#NMAKE=${HOME}/bin/nmake.bat # stupid ^M
NMAKE=${HOME}/bin/nmake.sh
nmake: ${PROJECT}.mak
${NMAKE} /f $<

it seems that gmake happend some ^M to the comandline

NMAKE : | error U1065: invalid option '-'^M

NMAKE / NMAKEFILE

$ cc-msvc.sh nmake.exe  /f cppproject.mak
INCLUDE=C:\opt\msvc98\VC98\Include
LIB=C:\opt\msvc98\VC98\Lib;C:\opt\msvc98\VC98\mfc\Lib
PATH=/mnt/c/opt/msvc98/VC98/Bin:/home/rzr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/kde2/bin:/usr/X11R6/bin:/usr/games:/usr/local/sbin:/usr/local/bin:.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
/usr/bin/wine /mnt/c/opt/msvc98/VC98/Bin/NMAKE.EXE /f cppproject.mak
Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
No configuration specified. Defaulting to cppproject - Win32 Debug.
if not exist "c:\tmp\Debug/nul" mkdir "c:\tmp\Debug"
cl.exe @X:\nma00009.
NMAKE : | error U1081: 'cl.exe' : program not found

I think this can be fixed, here is some way :

Edit *.mak

#CPP=cl.exe
CPP=C:\opt\msvc98\VC98\Bin\cl.exe^M
#LINK32=link.exe
LINK32=C:\opt\msvc\vc98\bin\link.exe

And look at your wine config if needed :

# cat ~/.wine/config
[[wine]]
"Path" = "C:\\windows;C:\\windows\\system;C:\opt\msvc98\VC98\Bin"

book

TOOLS

MISC TIPS ETC

MORE

msvc.txt · Last modified: 2022/04/16 12:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki