Ok, now I have a new problem. I'll try explain
First here is the 1st file's includes and whatnot right up to main, file1.cpp:
//Last Modification:
// September 2, 2006
#include <netinet/in.h> //needed for htonl(), ntohl()
#include <sys/socket.h> //needed for socket(), PF_INET
#include <sys/types.h> //needed for sockaddr_in, stat
#include <cstdlib> //needed for EXIT_FAILURE
#include <iostream> //needed for cout
#include <fstream> //needed for file input
#include <cstring> //needed for memset(), strstr(), strlen(), etc.
#include <netdb.h> //needed for gethostbyname()
#include <unistd.h> //needed for close(), stat(), fork()
#include <ctime> //needed for ctime(), time()
#include <sys/stat.h> //needed for stat()
#include <cstdio> //needed for sprintf()
#include "HandleRequests.cpp" //IF THIS IS COMMENTED OUT I HAVE PROBLEMS COMPILING A CERTAIN WAY
using namespace std;
enum Method {GET = 0, HEAD = 1, POST = 2};
int errno;
const int PORTBASE = 2200, //port number offset.
//Set to zero when testing is done and this
//becomes the default webserver.
QLEN = 10, //Number of outstanding connection requests
INBUF_SIZE = 4096, //Size of input buffer
OUTBUF_SIZE = 4096, //Size of output buffer
FN_SIZE=1024; //Maximum size of URL filename and path
//Function prototypes
int passivesock(const char *service, const char *transport, int qlen);
extern int handle_requests(int& ssock);
Here is the 2nd files, right up to handle_requests, file2.cpp:
#include <netinet/in.h> //needed for htonl(), ntohl()
#include <sys/socket.h> //needed for socket(), PF_INET
#include <sys/types.h> //needed for sockaddr_in, stat
#include <cstdlib> //needed for EXIT_FAILURE
#include <iostream> //needed for cout
#include <fstream> //needed for file input
#include <cstring> //needed for memset(), strstr(), strlen(), etc.
#include <netdb.h> //needed for gethostbyname()
#include <unistd.h> //needed for close(), stat(), fork()
#include <ctime> //needed for ctime(), time()
#include <sys/stat.h> //needed for stat()
#include <cstdio> //needed for sprintf()
using namespace std;
extern const int INBUF_SIZE;
extern const int OUTBUF_SIZE;
Now if I leave the code as is I can compile using this command:
g++ -o rockserver5 file1.cpp and get no errors and it seems to work fine.
But unless I misunderstood the professor he is going to compile our program like this:
g++ -o rockserver5 file1.cpp file2.cpp This gives me the error listed above, now if I comment out the #include "HandleRequests.cpp" I get these errors:
/tmp/ccDFw5zq.o(.text+0x4b2): In function `handle_requests(int&)':
: undefined reference to `INBUF_SIZE'
/tmp/ccDFw5zq.o(.text+0x4c0): In function `handle_requests(int&)':
: undefined reference to `INBUF_SIZE'
/tmp/ccDFw5zq.o(.text+0x522): In function `handle_requests(int&)':
: undefined reference to `OUTBUF_SIZE'
/tmp/ccDFw5zq.o(.text+0x530): In function `handle_requests(int&)':
: undefined reference to `OUTBUF_SIZE'