From: Jason G. <jgl...@go...> - 2010-04-06 17:52:25
|
When building for the HEAD of the tree at git:// anongit.freedesktop.org/git/dbus/dbus-c++/ I get the following error: g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I../include -I../include -fvisibility=hidden -Wall -O3 -MT eventloop-integration.lo -MD -MP -MF .deps/eventloop-integration.Tpo -c eventloop-integration.cpp -fPIC -DPIC -o .libs/eventloop-integration.o In file included from eventloop-integration.cpp:30: ../include/dbus-c++/eventloop-integration.h: In constructor ‘DBus::BusDispatcher::BusDispatcher()’: ../include/dbus-c++/eventloop-integration.h:71: error: ‘toString’ was not declared in this scope eventloop-integration.cpp: In member function ‘virtual void DBus::BusDispatcher::leave()’: eventloop-integration.cpp:93: error: ‘toString’ was not declared in this scope make[2]: *** [eventloop-integration.lo] Error 1 make[2]: Leaving directory `/usr/local/google/home/jglasgow/chromeos-wednesday/chromeos/src/third_party/dbus-c++/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/google/home/jglasgow/chromeos-wednesday/chromeos/src/third_party/dbus-c++' make: *** [all] Error 2 I have fixed this with the following patch. Is this a known problem? I am compiling on Ubuntu, but the problem also occurs in a portage build environment. Thanks for any information. Jason Glasgow diff --git a/examples/echo/echo-client.cpp b/examples/echo/echo-client.cpp index 093595f..8fe7ad7 100644 --- a/examples/echo/echo-client.cpp +++ b/examples/echo/echo-client.cpp @@ -6,6 +6,7 @@ #include <iostream> #include <pthread.h> #include <signal.h> +#include <stdio.h> using namespace std; diff --git a/include/dbus-c++/eventloop-integration.h b/include/dbus-c++/eventloop-integration.h index fd56c6e..2579273 100644 --- a/include/dbus-c++/eventloop-integration.h +++ b/include/dbus-c++/eventloop-integration.h @@ -26,6 +26,7 @@ #define __DBUSXX_EVENTLOOP_INTEGRATION_H #include <errno.h> +#include <string.h> #include "api.h" #include "dispatcher.h" #include "util.h" @@ -68,8 +69,12 @@ public: //pipe to create a new fd used to unlock a dispatcher at any // moment (used by leave function) int ret = pipe(_pipe); - if (ret == -1) throw Error("PipeError:errno", toString(errno).c_str()); - + if (ret == -1) { + char buffer[128]; + throw Error("PipeError:errno", strerror_r(errno, + buffer, + sizeof(buffer))); + } _fdunlock[0] = _pipe[0]; _fdunlock[1] = _pipe[1]; diff --git a/src/eventloop-integration.cpp b/src/eventloop-integration.cpp index d801574..53aea5f 100644 --- a/src/eventloop-integration.cpp +++ b/src/eventloop-integration.cpp @@ -90,8 +90,12 @@ void BusDispatcher::leave() _running = false; int ret = write(_fdunlock[1],"exit",strlen("exit")); - if (ret == -1) throw Error("WriteError:errno", toString(errno).c_str()); - + if (ret == -1) { + char buffer[128]; + throw Error("PipeError:errno", strerror_r(errno, + buffer, + sizeof(buffer))); + } close(_fdunlock[1]); close(_fdunlock[0]); } @@ -172,4 +176,3 @@ void BusDispatcher::watch_ready(DefaultWatch &ew) watch->handle(flags); } - |