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

Ivan Maidanski ivmai at
Thu Apr 29 00:08:05 PDT 2010

Thu, 29 Apr 2010 11:34:01 +0500 Yasir Majeed <leoyasir at>:

> 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)
> Mohammad Ali Jinnah University Islamabad, Pakistan
> +923335935382

More information about the Gc mailing list