Link error.(unresolved external symbol _main) 
Author Message
 Link error.(unresolved external symbol _main)

Hi,
I program a ASP component software using ATL/COM.
My program was compiled and linked in debug version.
But It's appear an link error in release version.
Compiler is a Visual C++ 5.0 and my program don't use MFC.
Used functions are fopen,fclose,sprintf,.........
Link error message is below.

Linking...
   Creating library ReleaseMinSize/MyProject.lib and object
ReleaseMinSize/MyProject.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseMinSize/MyProject.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

MyProject.dll - 2 error(s), 0 warning(s)

Thanks in advance.




Tue, 03 Apr 2001 03:00:00 GMT  
 Link error.(unresolved external symbol _main)
Short story:
Remove the _ATL_MIN_CRT macro from your project settings.

Long story:
fopen, fclose, sprintf etc. requires the C run time startup code.
I you check the settings for your project you'll notice the definition
of the macro _ATL_MIN_CRT. This prevents the inclusion of the CRT
startup code. Remove this macro and it should work. Unfortunately
this will add some size to your control. Another (better?) approach
is to replace fopen etc with Win32 API calls (OpenFile, wsprintf etc)

Claes Bergefall

Quote:

>Hi,
>I program a ASP component software using ATL/COM.
>My program was compiled and linked in debug version.
>But It's appear an link error in release version.
>Compiler is a Visual C++ 5.0 and my program don't use MFC.
>Used functions are fopen,fclose,sprintf,.........
>Link error message is below.

>Linking...
>   Creating library ReleaseMinSize/MyProject.lib and object
>ReleaseMinSize/MyProject.exp
>LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
>ReleaseMinSize/MyProject.dll : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.

>MyProject.dll - 2 error(s), 0 warning(s)

>Thanks in advance.





Tue, 03 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Linking error 2019 unresolved external symbol _main when porting to .NET

2. Linking error 2019 unresolved external symbol _main ...

3. Linking Problem when trying to create ReleaseUMinDependency[error LNK2001: unresolved external symbol _main]

4. Error LNK20001 unresolved external symbol main.

5. error LNK2001: unresolved external symbol _main

6. error LNL2001 : unresolved external symbol _main

7. release build error LNK2001: unresolved external symbol _main

8. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

9. LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

10. error LNK2001: unresolved external symbol _main

11. error LNL2001 : unresolved external symbol _main

12. error message unresolved external symbol _main

 

 
Powered by phpBB® Forum Software