Date: Fri, 18 Dec 1998 11:48:03 -0500 (EST) From: John Baldwin <jobaldwi@vt.edu> To: freebsd-questions@FreeBSD.ORG Subject: extern data.... Message-ID: <XFMail.981218114803.jobaldwi@vt.edu>
next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Last time I sent a C-related question to -chat and I was told to send it to - -questions, so I hope this is the right list. I have a static array of structs declated in module dblist.o as so: static fieldInfo DB_TYPES[DB_NUMTYPES]={ blah , blah , blah }; I have an extern statement in dblist.h as follows: extern fieldInfo DB_TYPES[DB_NUMTYPES]; I can use data fields from DB_TYPES[] fine in the dbtypes.o module. In another module (dblist.o) I look up some fields from DB_TYPES[]. dblist.o includes dbtypes.h and it compiles fine without any errors. However, when I try to link both of these modules together with other assorted modules gcc tells me: dblist.o: Undefined symbol `_DB_TYPES' referenced from text segment Do I need to use static in the extern declaration or something? Any help appreciated. - --- John Baldwin <jobaldwi@vt.edu> -- http://members.freedomnet.com/~jbaldwin/ PGP Key: http://members.freedomnet.com/~jbaldwin/pgpkey.asc I get mail, therefore I exist. -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQB1AwUBNnqHPIjYza302vYpAQGVAAMArdIDhIUsKp0jJEqnp5+bc+Z3mKSTXz0W wpsg3P1PX6KPZiYK08EtLGCih0ekfSwvZyYgagHSMNQInREqkVpsv6C/HF+GS2nI Ha9r0VdpcpLGjZBpgdEIfspLUt4JlMtk =8Dou -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.981218114803.jobaldwi>