From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17276 invoked by alias); 10 May 2007 11:07:29 -0000 Received: (qmail 17237 invoked by uid 22791); 10 May 2007 11:07:28 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 May 2007 11:07:26 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.1/8.13.1) with ESMTP id l4AB7OGS010003 for ; Thu, 10 May 2007 07:07:24 -0400 Received: from zebedee.littlepinkcloud.COM (vpn-14-59.rdu.redhat.com [10.11.14.59]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l4AB7L9m001788; Thu, 10 May 2007 07:07:22 -0400 Received: from littlepinkcloud.COM (localhost.localdomain [127.0.0.1]) by zebedee.littlepinkcloud.COM (8.13.8/8.13.5) with ESMTP id l4AB7KqL009007; Thu, 10 May 2007 12:07:20 +0100 Received: (from aph@localhost) by littlepinkcloud.COM (8.13.8/8.13.5/Submit) id l4AB7JMm009004; Thu, 10 May 2007 12:07:19 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17986.64743.402588.180994@zebedee.pink> Date: Thu, 10 May 2007 11:07:00 -0000 From: Andrew Haley To: gccNewbie Cc: gcc-help@gcc.gnu.org Subject: Re: Simple linking problem In-Reply-To: <10410954.post@talk.nabble.com> References: <10410954.post@talk.nabble.com> X-Mailer: VM 7.19 under Emacs 22.0.93.1 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00088.txt.bz2 gccNewbie writes: > > After spending years working in Java, I've decided I'd like to do a little C > programming. I've gotten gcc, which I think is the first step. In fact, I'm > using an old version, 3.2.3 for MinGW. I've done "Hello world" just to be > sure gcc is working. Now I'm trying to get gcc to link. > > I've studed all the options, all the ways to invoke gcc, and I can find > nothing helpful. I've got a library in a file starting with 'lib' and ending > with '.a'. I've downloaded this file from the web, I've downloaded the > source and used the makefile to compile the library. It seems that no matter > what I do I cannot get gcc to treat this file as a library containing the > stuff that I am absolutely sure it is supposed to contain. > > I know gcc is finding the file. If I go "gcc -lblah" and it cannot find > libblah.a, it will give me an error that tells me the library wasn't found. > So the library file is found. I see nothing in the documentation that > suggests I should need to do anything more than "gcc -lmylib test.c" to > compile 'test.c' with the functions defined in mylib. I have the library, I > tell gcc to use the library, and yet it acts as though these library > functions are undefined, giving 'undefined reference to' messages. > > I've looked at all the documentation I can think to study without finding > any possible solution. Is there any way to get gcc to tell me exactly what > is really in the library file? Yes. The command is called "nm". Andrew.