Hello,
compiling a small program that uses the MySQL++-library, I was wondering
why I have to include mysql's include directory to my include path.
Well, I know, otherwise the compiler won't be able to find the mysql
headers. But once it took me hours to hunt down an error that turned out
to be caused by two different libraries that had nothing to do with each
other, but both installed a header file with the same name
("exception.h", if I remember well).
That's why now I pretty much dislike adding everything to my include
path. Instead I for example write #include <mysql/mysql_version.h> and
keep the include path short.
But I can't do this with MySQL++, since MySQL++ relies on having the
MySQL headers in the include path.
Would a patch to the MySQL++ headers be accepted to include mysql
headers in the <mysql/...> way?
Some programs makefiles (or MSdev-settings) would possibly have to be
changed if mysql headers are installed in nonstandard locations.
So, what do you think?
Axel
PS: Here's a patch against todays svn, if you want to give it a try...
Index: lib/coldata.h
===================================================================
--- lib/coldata.h (revision 1635)
+++ lib/coldata.h (working copy)
@@ -41,7 +41,7 @@
#include "string_util.h"
#include "type_info.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <typeinfo>
#include <string>
Index: lib/common.h
===================================================================
--- lib/common.h (revision 1635)
+++ lib/common.h (working copy)
@@ -34,7 +34,7 @@
#if !defined(DOXYGEN_IGNORE)
// Doxygen will not generate documentation for the following stuff.
-#include <mysql_version.h>
+#include <mysql/mysql_version.h>
// Work out major platform-specific stuff here.
#if defined(__WIN32__) || defined(_WIN32)
@@ -140,7 +140,7 @@
// MySQL header. Basically, the above largely replaces MySQL's my_global.h
// while actually working with C++. This is why we disobey the MySQL
// developer docs, which recommend using my_global.h.
-#include <mysql.h>
+#include <mysql/mysql.h>
namespace mysqlpp {
Index: lib/connection.h
===================================================================
--- lib/connection.h (revision 1635)
+++ lib/connection.h (working copy)
@@ -40,7 +40,7 @@
#include "lockable.h"
#include "noexceptions.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <deque>
#include <string>
Index: lib/manip.h
===================================================================
--- lib/manip.h (revision 1651)
+++ lib/manip.h (working copy)
@@ -48,7 +48,7 @@
#include "myset.h"
#include "sql_string.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <iostream>
Index: lib/query.h
===================================================================
--- lib/query.h (revision 1635)
+++ lib/query.h (working copy)
@@ -38,7 +38,7 @@
#include "row.h"
#include "sql_string.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <deque>
#include <iomanip>
Index: lib/result.h
===================================================================
--- lib/result.h (revision 1635)
+++ lib/result.h (working copy)
@@ -38,7 +38,7 @@
#include "resiter.h"
#include "row.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <map>
#include <set>
Index: lib/type_info.h
===================================================================
--- lib/type_info.h (revision 1635)
+++ lib/type_info.h (working copy)
@@ -33,7 +33,7 @@
#include "common.h"
-#include <mysql.h>
+#include <mysql/mysql.h>
#include <map>
#include <typeinfo>