can anyone tell me why this code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <fstream.h>
using namespace std;
int main (int argc, char *argv[]) {
if (argc < 2) {
printf ("adduser usage:\n"
printf (" adduser <user-name>\n"
exit(1);
} else {
ifstream in;
char input[500];
in.open("dcusers.dat"
in >> input;
printf (input);
in.close();
exit(0);
}
}
gives this compile issue:
/tmp/ccbAO9EC.o: In function `main':
/tmp/ccbAO9EC.o(.text+0x49): undefined reference to `ifstream::ifstream(int)'
/tmp/ccbAO9EC.o(.text+0x66): undefined reference to `ifstream:pen(char const *, int, int)'
/tmp/ccbAO9EC.o(.text+0x84): undefined reference to `istream:perator>>(char *)'
/tmp/ccbAO9EC.o(.text+0xa8): undefined reference to `fstreambase::close(void)'
/tmp/ccbAO9EC.o(.text+0xc9): undefined reference to `ifstream::~ifstream(void)'
collect2: ld returned 1 exit status
???
I'm stumped, and very rusty at c++ programming. Steve Kiehl
webmaster@nanovox.com
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <fstream.h>
using namespace std;
int main (int argc, char *argv[]) {
if (argc < 2) {
printf ("adduser usage:\n"
printf (" adduser <user-name>\n"
exit(1);
} else {
ifstream in;
char input[500];
in.open("dcusers.dat"
in >> input;
printf (input);
in.close();
exit(0);
}
}
gives this compile issue:
/tmp/ccbAO9EC.o: In function `main':
/tmp/ccbAO9EC.o(.text+0x49): undefined reference to `ifstream::ifstream(int)'
/tmp/ccbAO9EC.o(.text+0x66): undefined reference to `ifstream:pen(char const *, int, int)'
/tmp/ccbAO9EC.o(.text+0x84): undefined reference to `istream:perator>>(char *)'
/tmp/ccbAO9EC.o(.text+0xa8): undefined reference to `fstreambase::close(void)'
/tmp/ccbAO9EC.o(.text+0xc9): undefined reference to `ifstream::~ifstream(void)'
collect2: ld returned 1 exit status
???
I'm stumped, and very rusty at c++ programming. Steve Kiehl
webmaster@nanovox.com