15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


error LNK2001: unresolved external symbol '_main'

Shrirang A Moghe -- samoghe@tdmail.india.ingr.com
Friday, May 17, 1996



Environment : Visual C++ 2.2 / WinNT 3.5 1/TD3 (Pentium, 99Mhz)

Dear Listers,

Used the AppWizard to produce a OLE full-server. Then thought of extending
the COleServerDoc by adding another interface. So, COleServerDocX is derived
from COleServerDoc. This extension produces a static library OLEX.LIB (note
not a dll, which has already given me a lot of indigestion). So, when I try 
to link
this library to produce the EXE. I get the error that _main is undefined, 
and it is
needed by libcmt.lib(crt0.obj).

 Note: (a) The static library has WIN32,_DEBUG,_WINDOWS,_UNICODE as the 
defines and (b) The EXE uses MFC in a shared dll + pre-processor definitions 
are :
_DEBUG,WIN32,_WINDOWS,_AFXDLL,_MBCS,NT

Appreciate you help. The following is the link output:

LINK : performing full link
libcmt.lib(realloc.obj) : error LNK2005: _realloc already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(malloc.obj) : error LNK2005: _malloc already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(free.obj) : error LNK2005: _free already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(crt0dat.obj) : error LNK2005: __exit already defined in 
msvcrt.lib(MSVCRT20.dll)
libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in 
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in 
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in 
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in 
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol "_main"
WinDebug/emdole.exe : error LNK1120: 1 unresolved externals

Regards,
Shrirang A. Moghe



Dean McCrory -- deanm@microsoft.com
Saturday, May 18, 1996

>>
> Note: (a) The static library has WIN32,_DEBUG,_WINDOWS,_UNICODE as the
>defines and (b) The EXE uses MFC in a shared dll + pre-processor
>definitions are :
>_DEBUG,WIN32,_WINDOWS,_AFXDLL,_MBCS,NT
<<

There's your goof. You need to compile the static library with exactly
the same compilation flags as is your EXE (after all, it is *part* of
your EXE when all things are said and done).  Of particular importance
is the fact that your library is missing _AFXDLL.

Hope that helps,

// Dean


>----------
>From: 	Shrirang A Moghe[SMTP:samoghe@tdmail.india.ingr.com]
>Sent: 	Friday, May 17, 1996 4:23 PM
>To: 	MFC-L
>Cc: 	Shrirang A Moghe
>Subject: 	error LNK2001: unresolved external symbol "_main"
>
>
>
>Environment : Visual C++ 2.2 / WinNT 3.5 1/TD3 (Pentium, 99Mhz)
>
>Dear Listers,
>
>Used the AppWizard to produce a OLE full-server. Then thought of
>extending
>the COleServerDoc by adding another interface. So, COleServerDocX is
>derived
>from COleServerDoc. This extension produces a static library OLEX.LIB
>(note
>not a dll, which has already given me a lot of indigestion). So, when I
>try to link
>this library to produce the EXE. I get the error that _main is
>undefined, and it is
>needed by libcmt.lib(crt0.obj).
>
> Note: (a) The static library has WIN32,_DEBUG,_WINDOWS,_UNICODE as the
>defines and (b) The EXE uses MFC in a shared dll + pre-processor
>definitions are :
>_DEBUG,WIN32,_WINDOWS,_AFXDLL,_MBCS,NT
>
>Appreciate you help. The following is the link output:
>
>LINK : performing full link
>libcmt.lib(realloc.obj) : error LNK2005: _realloc already defined in
>msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(malloc.obj) : error LNK2005: _malloc already defined in
>msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined
>in msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(free.obj) : error LNK2005: _free already defined in
>msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in
>msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(crt0dat.obj) : error LNK2005: __exit already defined in
>msvcrt.lib(MSVCRT20.dll)
>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
>msvcrt.lib(cinitexe.obj)
>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
>msvcrt.lib(cinitexe.obj)
>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
>msvcrt.lib(cinitexe.obj)
>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
>msvcrt.lib(cinitexe.obj)
>libcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol
>"_main"
>WinDebug/emdole.exe : error LNK1120: 1 unresolved externals
>
>Regards,
>Shrirang A. Moghe
>




| Вернуться в корень Архива |