curl_jsoncpp_example.cpp : https://gist.github.com/connormanning/41efa6075515019e499c
#include <json/json.h>
g++ main.cpp -ljsoncpp -lcurl -o example.out
so error : main.cpp:8:23: fatal error: json/json.h: No such file or directory
server did not support this, so i edited this section
#include <jsoncpp/json/json.h>
And now I'm faced with this error :
In file included from /usr/include/c++/5/cstdint:35:0,
from main.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
main.cpp: In function ‘int main()’:
main.cpp:44:5: error: ‘unique_ptr’ is not a member of ‘std’
std::unique_ptr<std::string> httpData(new std::string());
^
main.cpp:44:32: error: expected primary-expression before ‘>’ token
std::unique_ptr<std::string> httpData(new std::string());
^
main.cpp:44:60: error: ‘httpData’ was not declared in this scope
std::unique_ptr<std::string> httpData(new std::string());
I wanted to use this https://linux.tips/programming/how-to-install-and-use-json-cpp-library-on-ubuntu-linux-os But this is only for files inside the server
I want to get the information from a link json that is and print
exampel json link : http://date.jsontest.com
ptint json data ["time"] C++ or C ?
If you are familiar with PHP, this code is simply written :
<?php
$time = json_decode(file_get_contents('http://date.jsontest.com'),true);
echo $time['time'];
?>
But how to write in C++ or C ?
Please help me
jsoncppalone 3. Learn how to uselibcurlalone 4. Combine 1+2+3 4. PROFIT!