Hi, I need to compile some external libraries in a project of the linux client of thinger. io.
The library used is the same as in this case: Raspberry Pi & Linux Updating Cloud Data C++
I have tried to add the libraries and with cmake recompile the whole project but it doesn’t work.
Can someone help me?
My code is similar to the back case:
#include “thinger/thinger.h”
#include “wunderground/wunderground.hpp”
#include <ostream
#include <string#define USER_ID “xx”
#define DEVICE_ID “xx”
#define DEVICE_CREDENTIAL “xx”using namespace std;
string ApiKey="xxx"; wunderground::Conditions weather(ApiKey); weather.loadData("zagreb","croatia");
int main(int argc, char *argv)
{thinger_device thing(USER_ID, DEVICE_ID, DEVICE_CREDENTIAL);
thing[“data”] >> [=weather](pson& out){
out[“temp”] = weather.getCondition(“temperature”);
};while(true) { thing.handle(); thing.stream(thing["data"]); } return 0;
}
I’m trying to simulate what a temperature sensor reading would look like, so that in the future I can switch to a real sensor.
I’m adding to CmakeLists.txt this, and the folder wunderground is in the folder /src:
> # Support for wunder on Raspberry
> if(RASPBERRY)
> find_package(wunderground)
> if(WiringPi_FOUND)
> include_directories(${wunderground_INCLUDE_DIR})
> list(APPEND ADDITIONAL_LIBS ${wunderground_LIBRARIES})
> endif()
> endif()
Errors:
In function ‘int main(int, char**)’:
/home/r/Escritorio/raspb/src/main.cpp:60:22: error: expected ‘,’ before ‘weather’
thing["data"] >> [=weather](pson& out){
^
/home/r/Escritorio/raspb/src/main.cpp:60:22: warning: explicit by-copy capture of ‘weather’ redundant with by-copy capture default
/home/r/Escritorio/raspb/src/main.cpp: In lambda function:
/home/r/Escritorio/raspb/src/main.cpp:61:55: error: passing ‘const wunderground::Conditions’ as ‘this’ argument discards qualifiers [-fpermissive]
out["temp"] = weather.getCondition("temperature");
/home/r/Escritorio/raspb/src/main.cpp: In function ‘int main(int, char**)’:
/home/r/Escritorio/raspb/src/main.cpp:60:17: error: no match for ‘operator>>’ (operand types are ‘thinger::thinger_resource’ and ‘main(int, char**)::<lambda(protoson::pson&)>’)
thing["data"] >> [=weather](pson& out)
.
.
.
.
.
The line numbers are not the same because I have deleted many comments.
Thanks for your help. @alvarolb