faqts : Computers : Programming : Languages : Cobol

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 13 people (69%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Cobol: Compile: Command line: Error: 'unresolved external symbol _main' [link.exe]

Oct 4th, 2003 16:59
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 05 October 2003 - 01:17 am --------------------

Cobol: Compile: Command line: Error: 'unresolved external symbol 
_main' [link.exe]

---

When using the Microsoft 'link.exe' program, while running a batch file
with which to compile a helloworld.cob source file, the following error
is produced by the linker program:

 'unresolved external symbol _main'

---
---

Cause:

 you should not use

/SUBSYSTEM:console

but

/SUBSYSTEM:windows

in the options of the Microsoft link.exe program.

---
---

e.g.

link.exe c:\temp\helloworld.obj c:\fsc\pcobol32\f3bicimp.lib 
c:\fsc\pcobol32\libc.lib c:\fsc\pcobol32
\kernel32.lib /SUBSYSTEM:windows /OUT:c:\temp\helloworld.exe

works OK.

---

but this gives the error:

 link.exe c:\temp\helloworld.obj c:\fsc\pcobol32\f3bicimp.lib 
c:\fsc\pcobol32\libc.lib c:\fsc\pcobol32
\kernel32.lib /SUBSYSTEM:console /OUT:c:\temp\helloworld.exe

---

Microsoft (R) 32-Bit Incremental Linker Version 3.00.5270

Copyright (C) Microsoft Corp 1992-1995. All rights reserved.

libc.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in 
libc.lib(winc
rt0.obj)
libc.lib(crt0.obj) : error LNK2005: ___app_type already defined in 
libc.lib(winc
rt0.obj)
libc.lib(crt0.obj) : error LNK2005: ___error_mode already defined in 
libc.lib(wi
ncrt0.obj)
libc.lib(crt0.obj) : error LNK2005: __aexit_rtn already defined in 
libc.lib(winc
rt0.obj)
libc.lib(crt0.obj) : error LNK2005: __wenvptr already defined in 
libc.lib(wincrt
0.obj)
libc.lib(crt0.obj) : error LNK2005: __aenvptr already defined in 
libc.lib(wincrt
0.obj)
libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

c:\temp\helloworld.exe : fatal error LNK1120: 1 unresolved externals

---
---

Internet: see also:

[Internet: source: http://www.google.com search for 'unresolved 
external _main cobol': http://groups.google.com/groups?
q=unresolved+external+_main+cobol&hl=en&lr=&ie=UTF-
8&selm=3A62B3AB.5207%40zeusedit.com&rnum=2]

Cobol: Compile: Command line: How to compile Fijitsu COBOL v3.1 from 
the MSDOS command line?
http://www.faqts.com/knowledge_base/view.phtml/aid/25139

----------------------------------------------------------------------