求助关于静态库和动态库同时调用的问题,谢谢???
用MFC开发了一个居于对话框的运用程序,同时调用了一个静态库和一个动态库,如下:#include "stdafx.h"
#include "L2TOOL.h"
#include "L2TOOLDlg.h"
#include "..\LIB\COMLIB\COMLIB.h"
#include "..\LIB\SYSLIB\SYSLIB.h"
#pragma comment(lib, "D:\\3500Mill\\LIB\\LIBS\\COMLIB.lib")//静态库
#pragma comment(lib, "D:\\3500Mill\\LIB\\LIBS\\SYSLIB.lib")//动态库
class CL2TOOLDlg : public CDialog
{
。。。
}
在编译时出错,如下:
--------------------Configuration: L2TOOL - Win32 Debug--------------------
Linking...
libcd.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
libcd.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
libcd.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
libcd.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
libcd.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in libcd.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
msvcrtd.lib(cinitexe.obj) : warning LNK4098: defaultlib "libcd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/L2TOOL.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
L2TOOL.exe - 10 error(s), 2 warning(s)
这是库冲突吗,为什么会这样,怎么解决?知道的朋友请告诉一下,非常感谢!!
(如果我直接在tools->options下设置库的存放位置,在projects->setting下设置库名,编译就能通过了,为什么会这样呢)