Hi, there, I wanted to access GoogleCalendar from C++
so I attempted to build these client libs on OpenSUSE 42.1/64b
First - quite some of external dependencies are expired - usually the software moved to github, ok, downloaded from other source, copied into external_dependencies folder and ran the python script again
complaint about JSON GetFormattedMessages, fixed to GetFormatedMessages in my version of json parser - ok
CMake complains about missing Findcurl.cmake - just make symlink with proper character casing to google-api-cpp-client/external_dependencies/install/share/cmake-3.1/Modules/FindCURL.cmake
but in the end calendar_sample is attempted to build
[ 87%] Building CXX object src/samples/CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o
Linking CXX executable ../../bin/calendar_sample
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lgoogle_calendar_api
Aye- it seems no google_calendar_api has been built!
You try to follow advice from service_apis/calendar/readme.html to copy wanted API (calendar) to build/service_apis but to no avail -
MISLEADING advice then!
Now I am not really cmake knowledgeable, but in this emergency I went to /service_apis/CMakeLists.txt file and had suspicion with elegant code there that it does not really work in adding service subfolders and appended rudely and explicitly a line
add_subdirectory(calendar)
cmake in /build again and voila - API library got built correctly and calendar_sample attempts to link, but fails on unresolved references
Linking CXX executable ../../bin/calendar_sample
CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o: In function `googleapis::Display(std::string const&, google_calendar_api::Event const&)':
calendar_sample_main.cc:(.text+0x8ed): undefined reference to `google_calendar_api::Event::get_start() const'
calendar_sample_main.cc:(.text+0x92e): undefined reference to `google_calendar_api::Event::get_start() const'
calendar_sample_main.cc:(.text+0x9e3): undefined reference to `google_calendar_api::Event::get_end() const'
calendar_sample_main.cc:(.text+0xa1b): undefined reference to `google_calendar_api::Event::get_end() const'
CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o: In function `googleapis::CalendarSample::Startup(int, char**)':
calendar_sample_main.cc:(.text+0xd88): undefined reference to `googleapis::client::OAuth2AuthorizationFlow::MakeFlowFromClientSecretsPath(std::string const&, googleapis::client::HttpTransport*, googleapis::util::Status*)'
CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o: In function `googleapis::CalendarSample::Run()':
calendar_sample_main.cc:(.text+0x2694): undefined reference to `google_calendar_api::Event::mutable_start()'
calendar_sample_main.cc:(.text+0x2717): undefined reference to `google_calendar_api::Event::mutable_end()'
calendar_sample_main.cc:(.text+0x28f5): undefined reference to `google_calendar_api::Event::mutable_start()'
calendar_sample_main.cc:(.text+0x2978): undefined reference to `google_calendar_api::Event::mutable_end()'
calendar_sample_main.cc:(.text+0x2b6d): undefined reference to `google_calendar_api::Event::mutable_start()'
calendar_sample_main.cc:(.text+0x2bff): undefined reference to `google_calendar_api::Event::mutable_end()'
CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o: In function `void googleapis::DisplayList<google_calendar_api::CalendarList, google_calendar_api::CalendarListEntry>(std::string const&, std::string const&, google_calendar_api::CalendarList const&)':
calendar_sample_main.cc:(.text._ZN10googleapis11DisplayListIN19google_calendar_api12CalendarListENS1_17CalendarListEntryEEEvRKSsS5_RKT_[_ZN10googleapis11DisplayListIN19google_calendar_api12CalendarListENS1_17CalendarListEntryEEEvRKSsS5_RKT_]+0xd1): undefined reference to `google_calendar_api::CalendarList::get_items() const'
CMakeFiles/calendar_sample.dir/calendar_sample_main.cc.o: In function `void googleapis::DisplayList<google_calendar_api::Events, google_calendar_api::Event>(std::string const&, std::string const&, google_calendar_api::Events const&)':
calendar_sample_main.cc:(.text._ZN10googleapis11DisplayListIN19google_calendar_api6EventsENS1_5EventEEEvRKSsS5_RKT_[_ZN10googleapis11DisplayListIN19google_calendar_api6Even
Damn it, the things is right! calendar API does not really have the definitions - so let us add "monkey see - monkey-do" definitions directly in event.h
find get_start() method and add method body as
const EventDateTime get_start() const {
const Json::Value& storage = Storage("start");
return client::JsonValueToCppValueHelper<EventDateTime >(storage);
}
the same for
EventDateTime mutable_start() {
Json::Value* storage = MutableStorage("start");
return client::JsonValueToMutableCppValueHelper<EventDateTime>(storage);
}
and so on. When I say "it is annoying, I DO mean it" . Watch out for common copy-paste errors. Changes I did in order to run are in attached diff file.
The I finally could run the calendar-sample.
I mean - there is way too much of DO_IT_YOURSELF in my opinion! Rather half-baked stuff we have got here from GGL...
Maybe the code generator for CPP is broken - then please fix it. Or to say least - try to compile & run according to README before the library is published. Everybody should do that. You are not hobby programmers.
Jan