View Single Post
  #4  
Old 08-02-2008, 03:03 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I assume you're using GCC 4.3. If so, there's some information about this on the GCC website that I found through this forum using this Google search:
Quote:
C++ language issues
Header dependency cleanup

As detailed here (Header dependency streamlining), many of the standard C++ library include files have been edited to only include the smallest possible number of additional files. As such, many C++ programs that used std::memcpy without including <cstring>, or used std::auto_ptr without including <memory> will no longer compile.

Usually, this error is of the form:

error: 'strcmp' was not declared in this scope

The table below shows some of the missing items, and the header file that will have to be added as an #include for the compile to succeed.
If missing Then include this header
find, for_each, sort <algorithm>
ostream_iterator, istream_iterator <iterator>
auto_ptr <memory>
typeid <typeinfo>
isalnum, toupper <cctype>
INT_MIN, INT_MAX, RAND_MAX <climits>
printf <cstdio>
atoi, free, rand, exit <cstdlib>
EXIT_FAILURE <cstdlib>
strcmp, strdup, strcpy, memcpy <cstring>
In other words, change this in common/dbcore.cpp:
Code:
    1 #include "../common/debug.h"
    2 #include "../common/files.h"
    3 
    4 #ifdef WIN32
    5 #include <winsock2.h>
    6 #endif
    7 
    8 #include <iostream>
    9 using namespace std;
   10 #include <errmsg.h>
   11 #include <mysqld_error.h>
   12 #include <limits.h>
   13 #include "dbcore.h"
   14 #include <string.h>
   15 #include "../common/MiscFunctions.h"
   16 
   17 #ifdef WIN32
   18 	#define snprintf	_snprintf
   19 	#define strncasecmp	_strnicmp
   20 	#define strcasecmp	_stricmp
   21 	#include <process.h>
   22 #else
   23 	#include "unix.h"
   24 	#include <pthread.h>
   25 #endif
   26 
   27 #ifdef _EQDEBUG
   28 	#define DEBUG_MYSQL_QUERIES 0
   29 #else
   30 	#define DEBUG_MYSQL_QUERIES 0
   31 #endif
to something like this:
Code:
#include "../common/debug.h"
#include "../common/files.h"

#ifdef WIN32
#include <winsock2.h>
#endif

#include <iostream>
using namespace std;
#include <errmsg.h>
#include <mysqld_error.h>
#include <limits.h>
#include "dbcore.h"
#include <string.h>
#include "../common/MiscFunctions.h"
#include <cstdlib>

#ifdef WIN32
	#define snprintf	_snprintf
	#define strncasecmp	_strnicmp
	#define strcasecmp	_stricmp
	#include <process.h>
#else
	#include "unix.h"
	#include <pthread.h>
#endif

#ifdef _EQDEBUG
	#define DEBUG_MYSQL_QUERIES 0
#else
	#define DEBUG_MYSQL_QUERIES 0
#endif
Or you could do it the lazy way and just downgrade to 4.2 or 4.1 of GCC. I personally have 4.1 and it compiles fine. Long term, this is probably something that may needed to be added to the source in general.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote