VC6 编译选项问题
为了能将源文件编译成DLL目标代码。以前总以为是要设置/MT,/MD /MT d,/MD d. 那么在LINK命令行中有:
1)kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/audiolab.pdb" /machine:I386 /def:".\exportlib.def" /out:"Release/audiolab.dll" /implib:"Release/audiolab.lib"
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/audiolab.pdb" /machine:I386 /def:"../cpp/LIBEXPORT.DEF" /out:"release\audiolab.dll"
很重要一点就是将 /subsystem:console or /subsystem:windows 替换成/dll 是主要的。
其次,对于其他编译选项也要经常去学习。
如 /nologo /Gz /Zp4 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VC6WIN32DLL_EXPORTS" /Fo"Release/" /Fd"Release/" /FD /c
/nologo /Gz /Zp4 /MT /W3 /GX /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fo"Release/" /Fd"Release/" /FD /c
各个命令表示何意?请参阅网络资料。
1)http://blog.csdn.net/sunshine1314/article/details/2031298
2)http://hi.baidu.com/ankang1986/blog/item/ec211a9b4d7144bec9eaf40f.html
3) http://flcstudio.blog.163.com/blog/static/7560353920102410583320/