From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: fstream problems? Date: 19 Nov 2000 21:01:12 -0800 Organization: InterWorld Communications Lines: 53 Sender: nate AT mercury DOT st DOT hmc DOT edu Message-ID: <83y9yfdyp3.fsf@mercury.st.hmc.edu> References: <8FF1CB55A0wf89u AT 206 DOT 13 DOT 28 DOT 143> NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: nntp1.interworld.net 974696473 92734 134.173.57.219 (20 Nov 2000 05:01:13 GMT) X-Complaints-To: usenet AT news DOT interworld DOT net NNTP-Posting-Date: Mon, 20 Nov 2000 05:01:13 +0000 (UTC) User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com thelemur AT nowhere DOT not (Wesel) writes: > I have been having trouble with the fstream class in djgpp. It seems I > have a misplaced library, or perhaps a damaged one. No. > gcc -c test.cpp > gcc test.o -o test.exe This should be gxx, not gcc. > test.o(.text+0x32):test.cpp: undefined reference to > `ifstream::ifstream(int, cha > r const *, int, int)' > test.o(.text+0x48):test.cpp: undefined reference to > `istream::operator>>(int &)' > > test.o(.text+0x60):test.cpp: undefined reference to > `ifstream::~ifstream(void)' > test.o(.text+0x7a):test.cpp: undefined reference to > `ifstream::~ifstream(void)' > collect2: ld returned 1 exit status > make.exe: *** [test.exe] Error 1 > > --------------------------- > > Any suggestions? Even when I went > > gcc -lstdcxx test.o -o test.exe > > it gave the same errors. Because link order matters. If you'd put -lstdcxx at the end of the line, it should have worked, AFAIK. > For some reason, istream, and ifstream seem to be > present in the header files, but missing from the libraries. > > I desperately hope that's wrong though. I used cout and cin perfectly in > other programs. Only when I tried to use ifstream did things start blowing > up. > > Thank you for any advice > > > Wesel > Who's still brushing off the soot from his computer exploding... -- Nate Eldredge neldredge AT hmc DOT edu