Mail Archives: djgpp/2000/11/19/23:06:09
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | fstream problems?
|
From: | thelemur AT nowhere DOT not (Wesel)
|
Organization: | C.O.W. Inc
|
Message-ID: | <8FF1CB55A0wf89u@206.13.28.143>
|
User-Agent: | Xnews/03.07.28
|
Lines: | 58
|
Date: | Mon, 20 Nov 2000 03:54:56 GMT
|
NNTP-Posting-Host: | 63.197.122.98
|
X-Complaints-To: | abuse AT pacbell DOT net
|
X-Trace: | news.pacbell.net 974692496 63.197.122.98 (Sun, 19 Nov 2000 19:54:56 PST)
|
NNTP-Posting-Date: | Sun, 19 Nov 2000 19:54:56 PST
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I have been having trouble with the fstream class in djgpp. It seems I
have a misplaced library, or perhaps a damaged one.
The following code:
test.cpp:
---------------------------
#include <fstream>
void main(void)
{
int integer = 0;
ifstream fp("file.txt");
fp >> integer;
}
//end test.cpp
---------------------------
produced the following linker error:
---------------------------
gcc -c test.cpp
gcc test.o -o test.exe
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. 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...
- Raw text -