1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title></title>
</head>
<body>
<h1>
Microsoft C, C++, C# Compiler for Windows OS
</h1>
<pre>
Get a Free and Legal Copy of Microsoft Compiler to develop and test your programs for Windows without quitting Linux.
@ http://who.is.free.fr/wiki/index.php?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.
#rzr@nrv:lib/$ ls /home/rzr/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
#rzr@nrv:lib/$ ls /home/rzr/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 :
* nmake / use GNUmake should be possible
* Windows Mfc OpenGL & DirectX libs ?
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
#rzr@nrv:cproject/$ cat cmain.c
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
#ifdef _MSC_VER
printf("_MSC_VER=%d\n",_MSC_VER);
#endif
return ( EXIT_SUCCESS);
}
#rzr@nrv:cproject/$ ~/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
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
cmain.c
Microsoft (R) Incremental Linker Version 7.10.3052
Copyright (C) Microsoft Corporation. All rights reserved.
/out:cmain.exe
cmain.obj
#rzr@nrv:cproject/$ 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
* wrap autoconf scripts
* 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 : fatal error U1065: invalid option '-'^M
MISC TIPS
CONSOLE
How to enable disable console ( go to link options )
/subsystem:windows
/subsystem:console
Or put this in your main.cpp
#pragma comment(linker,"/ENTRY:WinMainCRTStartup")
#pragma comment(linker,"/SUBSYSTEM:CONSOLE")
FILES
Semi Useless files : .opt .ncb ...
http://filext.com/detaillist.php?extdetail=PDB
A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program.
SYMBOLS
The following are keywords in Microsoft C and C++. You can't use any C keywords in a C++ program.
Names with leading underscores are Microsoft extensions.
C Language Keywords:
unsigned signed
short float char int double long
void enum union typedef struct sizeof
if else
while do for
switch case default
break goto continue
return
static const extern volatile register
asm pascal __fortran
fastcall self auto segment based __segname
cdecl huge inline interrupt loadds near
export far __saveregs
C++ Language Keywords:
this class virtual friend private protected public
throw try catch
new delete
operator inline
multiple_inheritance single_inheritance __virtual_inheritance
The following are not keywords, but they have special meaning in Microsoft C++:
main
argc argv envp
_setenvp _set_new_handler __emit _setargv
#ifdef _MSC_VER // will detect if you're using msvc ++
#endif
MFC
Is there any free implementation of MFC ? the wine project may did
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwnd.asp
MISC
dll : libtool for msvc ? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dynamic_link_library_entry_point_function.asp
Emacs w/ msvc http://www.gnu.org/software/emacs/windows/faq10.html http://www.dotemacs.de/dotfiles/DavidJolley.emacs.html
LINKS
http://who.is.free.fr/wiki/index.php?MSVC
http://appdb.winehq.com/appview.php?appId=53&versionId=31
</pre>
<hr>
<address><a href="http://rzr.online.fr/">www.Philippe.COVAL.online.FR</a> </address>
<!-- hhmts start -->Last modified: Mon Jul 12 13:05:45 CEST 2004 <!-- hhmts end -->
</body> </html>
|