delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
X-Spam-Score: | 1.166 |
Message-ID: | <47AFEB3A.30203@sh.cvut.cz> |
Date: | Mon, 11 Feb 2008 07:29:14 +0100 |
From: | =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= <v DOT haisman AT sh DOT cvut DOT cz> |
User-Agent: | Thunderbird 2.0.0.9 (Windows/20071031) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: extern keyword and dlls |
References: | <BAY112-W28AE51E3894A2B44C59C2DF6290 AT phx DOT gbl> |
In-Reply-To: | <BAY112-W28AE51E3894A2B44C59C2DF6290@phx.gbl> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
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 |
--------------enigFB8A1B5BB77C115280552E4D Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable masta uy wrote, On 11.2.2008 0:40: > Hello, >=20 > I am in working on porting some code to cygwin but I am stuck. I need it = to be compiled as a dll but gcc gives me a linking error. >=20 > This code triggers the error: >=20 > extern int num; >=20 > int foo() { > extern int num; > num =3D 5; > } You are missing a definition of num. All you have now is just a declaration. >=20 >=20 > the error is: >=20 > hello.c:(.text+0x5): undefined reference to `_num' >=20 > And this is how I call gcc: "gcc -shared hello.c"=20 >=20 > Interestingly, the code above does work on my ubuntu installation (ubuntu= 7.10 gcc 4.1.3) >=20 > Any help is appreciated >=20 > Regards > Fernando -- VH --------------enigFB8A1B5BB77C115280552E4D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHr+tAoUFWwtEPkHIRCOp1AJwM4y8QicKx+8Smi5Mty2EdM/ISXgCePjwo LYAV1iPN3o6M5lUKFsfn/NE= =gmwy -----END PGP SIGNATURE----- --------------enigFB8A1B5BB77C115280552E4D--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |