Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <41353519.3090607@x-ray.at> Date: Wed, 01 Sep 2004 04:34:01 +0200 From: Reini Urban User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.8a2) Gecko/20040714 MIME-Version: 1.0 To: Jingzhao Ou CC: cygwin AT cygwin DOT com Subject: Re: Compiling TCL C extensions using Cygwin gcc References: <20040831223210 DOT 73946 DOT qmail AT web80404 DOT mail DOT yahoo DOT com> In-Reply-To: <20040831223210.73946.qmail@web80404.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Jingzhao Ou schrieb: > I tried to compile a simple Tcl C extension using Cygwin gcc. I use the > following commands: > > gcc -shared -ltcl -L/lib random.o > > I got the following error messege: > > random.o(.text+0x31):random.c: undefined reference to `_Tcl_WrongNumArgs' > random.o(.text+0x5e):random.c: undefined reference to `_Tcl_GetIntFromObj' > random.o(.text+0x98):random.c: undefined reference to `_Tcl_GetObjResult' > random.o(.text+0xad):random.c: undefined reference to `_Tcl_SetIntObj' > random.o(.text+0xe2):random.c: undefined reference to `_Tcl_PkgRequire' > random.o(.text+0x11a):random.c: undefined reference to `_Tcl_CreateObjCommand' > random.o(.text+0x135):random.c: undefined reference to `_Tcl_PkgProvide' > collect2: ld returned 1 exit status > > I can see that tcl.h is located at /usr/include. Also, libtcl84.a and > libtclstub84.a are located at /lib. > > Can any one kindly help me out? lots of beginners mistakes: there's a good gcc primer in the net. please check that out. http://www.network-theory.co.uk/gcc/intro/ 1. libs after the source, 2. library search path before the lib, otherwise it will not find it. 3. -shared ??? See that there's an tcl .a lib but no .dll (for completeness sake: no .la pointing to a .dll at /usr/bin), so you cannot build a shared exe. => gcc random.c -L/usr/lib -ltcl -o random but -L/usr/lib is redundant because thats in the standard search path => gcc random.c -ltcl -o random Note: the .exe extension is added automatically to random. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/