From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18261 invoked by alias); 19 Dec 2011 21:21:16 -0000 Received: (qmail 18250 invoked by uid 22791); 19 Dec 2011 21:21:15 -0000 X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Dec 2011 21:21:03 +0000 Received: by mail-wi0-f175.google.com with SMTP id hq7so1241010wib.20 for ; Mon, 19 Dec 2011 13:21:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.96.72 with SMTP id dq8mr2212179wib.10.1324329662591; Mon, 19 Dec 2011 13:21:02 -0800 (PST) Received: by 10.180.101.102 with HTTP; Mon, 19 Dec 2011 13:21:02 -0800 (PST) Date: Mon, 19 Dec 2011 21:21:00 -0000 Message-ID: Subject: Statically linking in a static library From: Anthony Weston To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-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: 2011-12/txt/msg00142.txt.bz2 Hi, I'm having trouble with statically linking. I've created a static library that statically links to other static libraries. My hope by doing this was so other users would only need to include one static library when linking in their executable. However when I nm the created the static library all the references are unresolved. Is there an argument that will force the linker to resolve these symbols? Example: libA.a defines functionA. libB.a defines functionB. I create libC.a which statically links and uses both libA.a and libB.a. When running nm libC.a the results show that neither functionA nor functionB can be resolved so libA.a and libB.a also need to be statically linked into the final executable. Thank you, Tony