I don't understand why I'm getting this error:
g++ -o tht testhashtable.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
Compilation exited abnormally with code 1 at Mon Dec 3 14:15:07
when I try to link the object file created by this code:
#include <iostream>
#include <fstream>
//using namespace std;
#include <stdlib.h>
#include "HashTable.h"
#include "HashableString.h"
#ifdef TEST_HASHTABLE
void main(void)//int argc, char *argv[])
{
HashTable<HashableString> ht(3);
string str;
char in[256];
while(true)
{
cout << "Enter Command : ";
gets(in);
str = in;
if(str == "q" || str == "")
{
cout << "Execution complete" << endl;
break;
}
if(str[0] == 'i')
{
string tmp = str.substr(2, str.length()-2);
HashableString htmp = tmp;
ht.search_and_insert(htmp);
}
if(str[0] == 's')
{
string tmp = str.substr(2, str.length()-2);
HashableString htmp = tmp;
if(ht.search(htmp))
{
cout << "Found in table " << endl;
}
else
{
cout << "Not found " << endl;
}
}
ht.debug_print();
}
return EXIT_SUCCESS;
}
#endif
Any help is much appreciated. TIA.