|
发表于 2019-7-18 13:17:25
|
显示全部楼层
1. 先做一个纯DOS下的dos16.exe, (masm5.0编译连接)
2. 然后做一个window下的win32.exe (VC6.0编译连接)
3. 在Vc++菜单|project|project|settings|link|projext Options:下加入
/Stub:dos16.exe (也就是在连接选项中接入改连接选项)
或者在程序中加入:#pragma comment(linker, "/Stub:dos16.exe")
(如果没有/stub:filename选项, VC默认加入winstub.exe到Win32.exe中)
编译win32.exe时, VC出现如下警告
dos16.exe : warning LNK4060: stub file missing full MS-DOS header; rebuild stub with /KNOWEAS 16-bit LINK option
意思使用masm5.0 连接dos16.exe时, 增加/KNOWEAS 选项, 但是该选项masm5.0不支持, 要使用masm6.11
经查找:
http://msdn.microsoft.com/en-us/library/aa267288(v=vs.60).aspx
Linker Tools Warning LNK4060
Visual Studio 6.0
stub file missing full MS-DOS header; rebuild stub with /KNOWEAS 16-bit LINK option
原因在这里:
The MS-DOS application specified with the /STUB option does not have a full 40-byte header. The stub program may not run as expected.
To rebuild the 16-bit stub with a full 40-byte header, use the undocumented /KNOWEAS option with the 16-bit LINK version 5.5x or higher.
也就是masm5.0的连接器版本过低.
解决办法是使用masm6.11
连接时增加/KNOWEAS 选项
例如
>link.exe /KNOWEAS dos16.obj
dos16.exe的编译连接过程请看
http://blog.csdn.net/cay22/article/details/7192848
其他
http://topic.csdn.net/t/20030321/10/1558195.html |
|