From: Attila Feher Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: Problems defining external symbols in C++ !? Date: Thu, 08 Feb 2001 08:42:55 +0200 Organization: Oy L M Ericsson Ab Lines: 22 Message-ID: <3A823FEF.ED20C18E@lmf.ericsson.se> References: <35dcd766 DOT 101916239 AT news DOT pathcom DOT com> NNTP-Posting-Host: lmf7ws49.lmf.ericsson.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ronto.lmf.ericsson.se 981614575 7475 131.160.27.146 (8 Feb 2001 06:42:55 GMT) X-Complaints-To: newsmaster AT lmf DOT ericsson DOT se NNTP-Posting-Date: 8 Feb 2001 06:42:55 GMT X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: hu, en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Oliver Richman wrote: > > I am converting a large C program to C++ using DJGPP, and all is going > well, but for some reason when I do this: > > from moo.cc: > const struct moostruct moovariable[] = { ... } > > from moo2.cc: > extern const struct moostruct moovariable[]; > > I get an "undefined reference to moovariable" in moo2.cc. I assume it is a compiler and not linker error. Look at your lines in moo2.cc! How is moo2.cc supposed to know the size, the data members etc. of your struct? You need to make (using a header file usually) moo2.cc to know the structure of the structure :-)) BTW, I would use class in C++ (named class) and instantiate the constant from it... A