delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:message-id:subject:mime-version | |
:content-type:content-transfer-encoding; q=dns; s=default; b=nwB | |
6qdXZU6gZYfGt3BvWlWQV8rQpN70kf+1gvPtyTbPXkeNOErTaziPOtXs0gvPSzzv | |
Hg272LXohBczxXzihbQYzrJ/UrzY186e9i8NVIbAVRkoxoMQWOfk82B/e550zTKa | |
LjP8wVXQkkyRIxcCnGB2HWBNxNTF22NBPL8A38NE= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:message-id:subject:mime-version | |
:content-type:content-transfer-encoding; s=default; bh=2LYw6Qz4I | |
+zklpNU0PCs8TZq+pU=; b=N6us1u371uDQS5NWBDnhPLSdj8k1wo0hIn4V6FSBs | |
dY/pxuGDT+xLcaO5q5nr0XwrpRxtIavDRan2PRJ0g5Vr9Cpf2LYVeqJHCY8NU8RF | |
8DIIUQp7wcXjTS3V4sWSXsoBSG9RjyzTSokuNHqN1IuLe/n9J/aIagT3H701r3SD | |
Xk= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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 |
Date: | Sun, 10 Feb 2019 11:28:39 +0100 (CET) |
From: | "C.J. Wagenius" <cjw AT voidptr DOT se> |
To: | <cygwin AT cygwin DOT com> |
Message-ID: | <LYLwuaD--3-1@voidptr.se> |
Subject: | undefined reference when linking against glib-2.0 |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id x1AAYRvP005079 |
 Hi.  I'm trying to compile the following source file --- #include <glib.h> #include <stdio.h> int main(int argc, char **argv) {  int *a;  a = g_new(int, 1);  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 devel 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' $ gcc -Wl,--verbose -o testa `pkg-config --cflags --libs glib-2.0` -m32 test.c In file included from /usr/lib/glib-2.0/include/glibconfig.h:9:0,                 from /usr/include/glib-2.0/glib/gtypes.h:32,                 from /usr/include/glib-2.0/glib/galloca.h:32,                 from /usr/include/glib-2.0/glib.h:30,                 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 '_GStaticAssertCompileTimeAssertion_0' is negative #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED                                                     ^ /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                                               ^~~~~~~~~~~ /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 (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED                                            ^~~~~~~ /usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_STATIC_ASSERT'   G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));   ^~~~~~~~~~~~~~~ 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |