This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc and microsoft linker


>Date: Mon, 11 Sep 2000 15:08:58 -0400
>To: bug-gcc@ prep.ai.mit.edu
>From: Dibyendu Ghosh <dghosh@synopsys.com>
>Subject: gcc and microsoft linker
>
>Hi,
>
>In my project which is on Windows NT 4.0, I am in a situation where, I
need to build most of the source files using gcc and some files using
cl.exe (which comes with microsoft vc++ 6.0). I was getting some problem,
so to simulate it using a small sample project I tried all possible options
using gcc, cl and link.exe (which comes with vc6.0). I just created a file
mainfunc.c with the following contents:
>
>extern void libfunc();
>
>int main()
>{
>	libfunc();
>	return 0;
>}
>
>And another source file, libfunc.c with the following contents:
>
>#include<stdio.h>
>
>void libfunc()
>{
>	printf("From LibFunc\n");
>}
>
>And then I compile these two files and generate mainfunc.o, libfunc.o,
mainfunc.obj, libfunc.obj.
>And the I try to build my executable using all possible combinations.
>
>What I find is that link.exe doesn't understand mainfunc.o much and gives
one unresolved external as follows:
>
>Full output from link.exe:
>==========================
>
>Microsoft (R) 32-Bit Incremental Linker Version 5.10.7303
>Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
>
>
>Searching Libraries
>    Searching d:\Programs\Micros~1\VC98\LIB\LIBC.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\OLDNAMES.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\kernel32.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\LIBC.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\OLDNAMES.lib:
>
>Done Searching Libraries
>mainfunc.o : error LNK2001: unresolved external symbol ___main
>gcctest3.exe : fatal error LNK1120: 1 unresolved externals
>
>=====================================================================
>
>Then I tried to resolve this by passing libcygwin.a also to link.exe, it
builds the executable, but generates a warning, and later GPF occurs when
running the executable. How do I resolve this problem?
>
>======================================================================
>Full output from linker in this case:
>_____________________________________
>
>Microsoft (R) 32-Bit Incremental Linker Version 5.10.7303
>Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
>
>
>Searching Libraries
>    Searching
c:\Cygnus\cygwin-b20\h-i586-cygwin32\i586-cygwin32\lib\libcygwin.a:
>libcygwin.a(ds7.o) : warning LNK4078: multiple ".idata" sections found
with different attributes (40000000)
>    Searching d:\Programs\Micros~1\VC98\LIB\LIBC.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\OLDNAMES.lib:
>    Searching d:\Programs\Micros~1\VC98\LIB\kernel32.lib:
>
>Done Searching Libraries
>___________________________________________________________________________
__________________________________
>===========================================================================
==================================
>
>Any suggestions/comments on this problem are most welcome!
>With Thanks in Advance,
>Dibyendu Ghosh

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]