Mail Archives: djgpp/2000/11/20/00:19:41
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
- Raw text -