From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83646 invoked by alias); 10 Feb 2019 10:28:44 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 83639 invoked by uid 89); 10 Feb 2019 10:28:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=BAYES_00,GIT_PATCH_2,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=devel, H*F:D*se X-HELO: w4.tutanota.de Received: from w4.tutanota.de (HELO w4.tutanota.de) (81.3.6.165) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Feb 2019 10:28:42 +0000 Received: from w2.tutanota.de (unknown [192.168.1.163]) by w4.tutanota.de (Postfix) with ESMTP id E843710600E7 for ; Sun, 10 Feb 2019 10:28:39 +0000 (UTC) Date: Sun, 10 Feb 2019 10:28:00 -0000 From: "C.J. Wagenius" To: Message-ID: Subject: undefined reference when linking against glib-2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00100.txt.bz2 =C2=A0Hi. =C2=A0I'm trying to compile the following source file --- #include #include int main(int argc, char **argv) { =C2=A0 int *a; =C2=A0 a =3D g_new(int, 1); =C2=A0 g_free(a); return 0; } --- ... and get linking errors. $ gcc -Wl,--verbose -o testa `pkg-config --cflags --libs glib-2.0` test.c /tmp/ccHtEBvg.o:test.c:(.text+0x1e): undefined reference to `g_malloc_n' /tmp/ccHtEBvg.o:test.c:(.text+0x2e): undefined reference to `g_free' collect2: error: ld returned 1 exit status (attempt to open /usr/lib/gcc/i686-pc-cygwin/7.4.0/../../../libglib-2.0.dll= .a succeeded) Windows 7 64-bit using 32-bin Cygwin. glib-2.0 (2.54.3-1) libraries and dev= el packages are installed. What am I missing? I've tried with 64-bin Cygwin too. $ gcc -Wl,--verbose -o testa `pkg-config --cflags --libs glib-2.0` test.c /tmp/ccyW0KzO.o:test.c:(.text+0x1f): undefined reference to `g_malloc_n' /tmp/ccyW0KzO.o:test.c:(.text+0x1f): relocation truncated to fit: R_X86_64_= PC32 against undefined symbol `g_malloc_n' /tmp/ccyW0KzO.o:test.c:(.text+0x2f): undefined reference to `g_free' /tmp/ccyW0KzO.o:test.c:(.text+0x2f): relocation truncated to fit: R_X86_64_= PC32 against undefined symbol `g_free' $=C2=A0 gcc -Wl,--verbose -o testa `pkg-config --cflags --libs glib-2.0` -m= 32 test.c In file included from /usr/lib/glib-2.0/include/glibconfig.h:9:0, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 from /usr/include/glib-2.0/glib/gtypes.h:32, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 from /usr/include/glib-2.0/glib/galloca.h:32, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 from /usr/include/glib-2.0/glib.h:30, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 from test.c:2: /usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64': /usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array '_GStatic= AssertCompileTimeAssertion_0' is negative #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTi= meAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ^ /usr/include/glib-2.0/glib/gmacros.h:229:47: note: in definition of macro '= G_PASTE_ARGS' #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:232:44: note: in expansion of macro 'G= _PASTE' #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTi= meAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~ /usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_S= TATIC_ASSERT' =C2=A0=C2=A0 G_STATIC_ASSERT(sizeof (unsigned long long) =3D=3D sizeof (gui= nt64)); =C2=A0=C2=A0 ^~~~~~~~~~~~~~~ I'm obviously doing something wrong. Thanks for help. /cjw -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple