| delorie.com/archives/browse.cgi | search |
| From: | Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> |
| Newsgroups: | comp.os.msdos.djgpp,comp.lang.c++ |
| Subject: | Re: Problems defining external symbols in C++ !? |
| Date: | 8 Feb 2001 12:44:32 GMT |
| Organization: | Aachen University of Technology (RWTH) |
| Lines: | 34 |
| Message-ID: | <95u4bg$joo$1@nets3.rz.RWTH-Aachen.DE> |
| References: | <35dcd766 DOT 101916239 AT news DOT pathcom DOT com> <3A823FEF DOT ED20C18E AT lmf DOT ericsson DOT se> |
| NNTP-Posting-Host: | acp3bf.physik.rwth-aachen.de |
| X-Trace: | nets3.rz.RWTH-Aachen.DE 981636272 20248 137.226.32.75 (8 Feb 2001 12:44:32 GMT) |
| X-Complaints-To: | abuse AT rwth-aachen DOT de |
| NNTP-Posting-Date: | 8 Feb 2001 12:44:32 GMT |
| Originator: | broeker@ |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
In comp.os.msdos.djgpp Attila Feher <Attila DOT Feher AT lmf DOT ericsson DOT se> wrote:
> 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.
I strongly doubt that. "undefined reference" *is* a linker error. You
probably tried to compile moo2.cc to an executable on its own, without
linking moo.o to it.
g++ -O2 -o moo2.exe moo2.cc moo.cc
should work.
> 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 :-))
If that had been the problem the compiler would have complained,
giving an error message like 'reference to incompletely defined
datatype'.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |