Mail Archives: cygwin/1996/10/27/09:47:48
Why do I get the following errors when I try to compile the simple
program below the errors using gnu-win32 compiler?
gcc -I/usr/lib/g++-include -o garp.exe garp.cpp
/WINDOWS/TEMP/cc0011741.o(.text+0x80):garp.cc: undefined reference
to `ofstream::ofstream(int, char const *, int, int)'
/WINDOWS/TEMP/cc0011741.o(.text+0x8c):garp.cc: undefined reference
to `ios::operator!(void) const'
/WINDOWS/TEMP/cc0011741.o(.text+0x9a):garp.cc: undefined reference
to `endl(ostream &)'
/WINDOWS/TEMP/cc0011741.o(.text+0xa4):garp.cc: undefined reference
to `cerr'
/WINDOWS/TEMP/cc0011741.o(.text+0xa9):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
/WINDOWS/TEMP/cc0011741.o(.text+0xb4):garp.cc: undefined reference
to `ostream::operator<<(ostream &(*)(ostream &))'
/WINDOWS/TEMP/cc0011741.o(.text+0xce):garp.cc: undefined reference
to `endl(ostream &)'
/WINDOWS/TEMP/cc0011741.o(.text+0xd8):garp.cc: undefined reference
to `endl(ostream &)'
/WINDOWS/TEMP/cc0011741.o(.text+0xe2):garp.cc: undefined reference
to `cout'
/WINDOWS/TEMP/cc0011741.o(.text+0xe7):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
/WINDOWS/TEMP/cc0011741.o(.text+0xfb):garp.cc: undefined reference
to `ostream::operator<<(ostream &(*)(ostream &))'
/WINDOWS/TEMP/cc0011741.o(.text+0x10f):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
/WINDOWS/TEMP/cc0011741.o(.text+0x11a):garp.cc: undefined reference
to `ostream::operator<<(ostream &(*)(ostream &))'
/WINDOWS/TEMP/cc0011741.o(.text+0x125):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
/WINDOWS/TEMP/cc0011741.o(.text+0x141):garp.cc: undefined reference
to `cin'
/WINDOWS/TEMP/cc0011741.o(.text+0x146):garp.cc: undefined reference
to `istream::operator>>(int &)'
/WINDOWS/TEMP/cc0011741.o(.text+0x15a):garp.cc: undefined reference
to `istream::operator>>(char *)'
/WINDOWS/TEMP/cc0011741.o(.text+0x16e):garp.cc: undefined reference
to `istream::operator>>(float &)'
/WINDOWS/TEMP/cc0011741.o(.text+0x17d):garp.cc: undefined reference
to `ios::operator void *(void) const'
/WINDOWS/TEMP/cc0011741.o(.text+0x191):garp.cc: undefined reference
to `endl(ostream &)'
/WINDOWS/TEMP/cc0011741.o(.text+0x1b2):garp.cc: undefined reference
to `ostream::operator<<(int)'
/WINDOWS/TEMP/cc0011741.o(.text+0x1c6):garp.cc: undefined reference
to `ostream::operator<<(char)'
/WINDOWS/TEMP/cc0011741.o(.text+0x1da):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
/WINDOWS/TEMP/cc0011741.o(.text+0x1ee):garp.cc: undefined reference
to `ostream::operator<<(char)'
/WINDOWS/TEMP/cc0011741.o(.text+0x202):garp.cc: undefined reference
to `ostream::operator<<(float)'
/WINDOWS/TEMP/cc0011741.o(.text+0x216):garp.cc: undefined reference
to `ostream::operator<<(ostream &(*)(ostream &))'
/WINDOWS/TEMP/cc0011741.o(.text+0x225):garp.cc: undefined reference
to `cout'
/WINDOWS/TEMP/cc0011741.o(.text+0x22a):garp.cc: undefined reference
to `ostream::operator<<(char const *)'
Here's the program
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
main ()
{
ofstream outClientFile("/tmp/foo2.dat", ios::out);
if (!outClientFile) {
cerr << "File could not be opened" << endl;
exit(1);
}
cout << "Enter acct, name and balance" << endl
<< "Enter to finish" << endl << "? ";
int account;
char name[10];
float balance;
while (cin >> account >> name >> balance) {
outClientFile << account << ' ' << name
<< ' ' << balance << endl;
cout << "? ";
}
return 0;
}
-------------------------------------
Name: Garry Boyce
E-mail: garp AT opustel DOT opustel DOT com (Garry Boyce)
Date: 12/01/94
Time: 08:46:10
This message was sent by Chameleon
-------------------------------------
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -