Re[2]: [Gc] Problem linking libgc.a with Visual Studio

Ivan Maidanski ivmai at mail.ru
Thu Apr 29 01:32:43 PDT 2010


Thu, 29 Apr 2010 13:26:40 +0500 Yasir Majeed <leoyasir at gmail.com>:

> 
> Thanx Ivan for the reply, I tried ur method, when i run the command
> 
> ?
> 
> lib /out:gc.lib *.obj
> 
> ?
> 
> Although this command worked but it gave lots of warning like below
> 
> 
> pcr_interface.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that
> consumes this library

I haven't seen such warnings but probably it's ok (for pcr_interface and similar).

> 
> So when i compiled my program using Visual C, the errors were same as i already told u. Can u tell me what is wrong?

But test.exe is build correctly, right?

Could you show these errors?

> 
> 2010/4/29 Ivan Maidanski <ivmai at mail.ru>
> 
> Thu, 29 Apr 2010 11:34:01 +0500 Yasir Majeed <leoyasir at gmail.com>:
> 
> > Dear all!
> >
> > I want to link library file libgc.a or gc.lib with my Visual C 2010. But it is giving link error for the functions like GC_malloc and GC_free. I have given gc.lib and libgc.a as the input to the linker. In Visual C you specify lib files in project properties->linker->input. I have specified ws2_32.lib and iphlpapi.lib correctly. But even i specfied library file for gc but it still gives link errors. Can someone tell me how to remove that error?
> 
> You should build and link gc.lib with Visual C. E.g.:
> 
> cl -MT -DALL_INTERIOR_POINTERS T -DGC_THREADS -I.\include -I.\libatomic_ops\src -D_CRT_SECURE_NO_DEPRECATE -c *.c *.cpp
> lib /out:gc.lib *.obj
> cl -MT -DALL_INTERIOR_POINTERS T -DGC_THREADS -I.\include -I.\libatomic_ops\src -D_CRT_SECURE_NO_DEPRECATE tests\test.c gc.lib user32.lib
> 
> (The last command produces test.exe.)
> 
> 
> 
> 
> 
> >
> > Regards
> >
> > --
> > Yasir Majeed
> > Ph.D scholar
> > Center of Research in Networks and Telecommunication (CoReNeT)
> > www.corenet.org.pk
> > Mohammad Ali Jinnah University Islamabad, Pakistan
> > +923335935382



More information about the Gc mailing list