Skip to content

nlohmann::json library error

Hi all,

I’m currently working on a project to get the current temperature with the OpenWeahterAPI, but I’m facing a problem. I work with eclipse with the internal PLCnext libraries curl and nlohmann json. I tested everything with a ‘normal’ C++ project and it works. When converting it to the PLCnext platform it doesn’t compile correctly.

[code type="markup"]
#include "MyProgram.hpp"
#include "Arp/System/Commons/Logging.h"
#include "Arp/System/Core/ByteConverter.hpp"

#include
#include
#include

#include

#include
using json = nlohmann::json;

using namespace std;

//External functions
void Cleanup(CURL* curl, curl_slist* headers);
size_t curl_callback(void* ptr, size_t size, size_t nmemb, std::string* data);
string GetRequest(const string url);

namespace My
{
void MyProgram::Execute()
{
//implement program

string _city = "jakarta";
string _key = "15fde79be05d1b10c25c13a291bdecf7";

string url = "http://api.openweathermap.org/data/2.5/weather?q=" + _city + "&appid=" + _key;

string json_string = GetRequest(url);

const char* char_str = json_string.c_str();

json j_obj;
j_obj = json::parse(char_str); //<- problem

float temperature = j_obj["main"]["temp"];

temperature -= 273.15;

}

} // end of namespace My
[/code]

The current problem is that the line ( j_obj = json::parse(char_str) ) gives a problem. The error code in eclipse is as follows:
[img]https://i.imgur.com/l4Hsetl.png[/img]

When trying to compile the following errormessages are generated:
[code type="markup"]
cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" generate code -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse" -s"src""
Generating all files with the 'code' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse.
Successfully generated all files with the 'code' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse.

cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" generate config -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse" -s"src""
Generating all files with the 'config' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse.
Successfully generated all files with the 'config' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse.

cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" build -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse" -b Release"
Requested build for targets AXCF2152,21.0.3.35554
Starting build for target AXCF2152,21.0.3.35554
Checking if CMake needs to be reconfigured...
[cmake]:
[cmake]: C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse\intermediate\cmake\AXCF2152,21.0.3.35554\Release>set PATH=C:\SDKs\AXCF2152\sysroots\x86_64-pokysdk-mingw32\usr\bin;C:/Users/usermait/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.2.v20210201-0955/jre/bin/server;C:/Users/usermait/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.2.v20210201-0955/jre/bin;C:\TwinCAT\Common64;C:\TwinCAT\Common32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\TDM-GCC-64\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\usermait\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\usermait\AppData\Local\Programs\Python\Python39\;C:\Users\usermait\AppData\Local\Microsoft\WindowsApps;C:\Users\usermait\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Common Files\Hilscher GmbH\TLRDecode;C:\Users\usermait\Downloads\Documents\DevOps\packer_1.6.6_windows_amd64;C:\Users\usermait\.dotnet\tools;C:\Program Files (x86)\Nmap;C:\Program Files\PHOENIX CONTACT\PLCnCLI\;C:\Program Files\CMake\bin;C:\Users\usermait\eclipse\cpp-2021-03\eclipse;
[cmake]: make[1]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: Scanning dependencies of target WeatherAPI_cpp_eclipse
[cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: [ 12%] Building CXX object CMakeFiles/WeatherAPI_cpp_eclipse.dir/src/MyProgram.cpp.o
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:60,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:2,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h: In member function 'std::pair std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_hint_unique_pos(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, const key_type&) [with _Key = std::__cxx11::basic_string; _Val = std::pair, nlohmann::basic_json<> >; _KeyOfValue = std::_Select1st, nlohmann::basic_json<> > >; _Compare = std::less; _Alloc = std::allocator, nlohmann::basic_json<> > >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h:2187:5: note: parameter passing for argument of type 'std::_Rb_tree, std::pair, nlohmann::basic_json<> >, std::_Select1st, nlohmann::basic_json<> > >, std::less, std::allocator, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator, nlohmann::basic_json<> > >'} changed in GCC 7.1
[cmake]: 2187 | _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
[cmake]: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h: In member function 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple, std::allocator >&>, std::tuple<>}; _Key = std::__cxx11::basic_string; _Val = std::pair, nlohmann::basic_json<> >; _KeyOfValue = std::_Select1st, nlohmann::basic_json<> > >; _Compare = std::less; _Alloc = std::allocator, nlohmann::basic_json<> > >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h:2452:7: note: parameter passing for argument of type 'std::_Rb_tree, std::pair, nlohmann::basic_json<> >, std::_Select1st, nlohmann::basic_json<> > >, std::less, std::allocator, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator, nlohmann::basic_json<> > >'} changed in GCC 7.1
[cmake]: 2452 | _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
[cmake]: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:61,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:2,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h: In member function 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string; _Tp = nlohmann::basic_json<>; _Compare = std::less; _Alloc = std::allocator, nlohmann::basic_json<> > >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h:499:8: note: parameter passing for argument of type 'std::_Rb_tree, std::pair, nlohmann::basic_json<> >, std::_Select1st, nlohmann::basic_json<> > >, std::less, std::allocator, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator, nlohmann::basic_json<> > >'} changed in GCC 7.1
[cmake]: 499 | __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/vector:72,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscReader.hpp:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscServerContext.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceStub.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceFactory.hpp:9,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Acf/ComponentBase.hpp:10,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyComponent.hpp:3,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:5,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::_M_erase(std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:171:5: note: parameter passing for argument of type 'std::vector, std::allocator > >::iterator' {aka '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >'} changed in GCC 7.1
[cmake]: 171 | vector<_Tp, _Alloc>::
[cmake]: | ^~~~~~~~~~~~~~~~~~~
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {nlohmann::detail::value_t}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector, std::allocator > >::iterator' {aka '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >'} changed in GCC 7.1
[cmake]: 426 | vector<_Tp, _Alloc>::
[cmake]: | ^~~~~~~~~~~~~~~~~~~
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {std::__cxx11::basic_string, std::allocator >&}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator >]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector, std::allocator > >::iterator' {aka '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >'} changed in GCC 7.1
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:61,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:2,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h: In member function 'bool nlohmann::detail::json_sax_dom_callback_parser::key(nlohmann::detail::json_sax_dom_callback_parser::string_t&) [with BasicJsonType = nlohmann::basic_json<>]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h:499:8: note: parameter passing for argument of type 'std::_Rb_tree, std::pair, nlohmann::basic_json<> >, std::_Select1st, nlohmann::basic_json<> > >, std::less, std::allocator, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator, nlohmann::basic_json<> > >'} changed in GCC 7.1
[cmake]: 499 | __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/vector:72,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscReader.hpp:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscServerContext.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceStub.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceFactory.hpp:9,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Acf/ComponentBase.hpp:10,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyComponent.hpp:3,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:5,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'bool nlohmann::detail::parser::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_parser >; BasicJsonType = nlohmann::basic_json<>]':
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >' changed in GCC 7.1
[cmake]: 121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
[cmake]: | ^~~~~~~~~~~~~~~~~
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:61,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:2,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h:499:8: note: parameter passing for argument of type 'std::_Rb_tree, std::pair, nlohmann::basic_json<> >, std::_Select1st, nlohmann::basic_json<> > >, std::less, std::allocator, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator, nlohmann::basic_json<> > >'} changed in GCC 7.1
[cmake]: 499 | __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
[cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/vector:72,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscReader.hpp:13,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscServerContext.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceStub.hpp:8,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceFactory.hpp:9,
[cmake]: from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Acf/ComponentBase.hpp:10,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyComponent.hpp:3,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.hpp:5,
[cmake]: from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/src/MyProgram.cpp:1:
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >' changed in GCC 7.1
[cmake]: 121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
[cmake]: | ^~~~~~~~~~~~~~~~~
[cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator*, std::vector, std::allocator > > >' changed in GCC 7.1
[cmake]: 121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
[cmake]: | ^~~~~~~~~~~~~~~~~
[cmake]: [ 25%] Linking CXX shared library libWeatherAPI_cpp_eclipse.so
[cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: [100%] Built target WeatherAPI_cpp_eclipse
[cmake]: make[1]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: make[1]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: Linking CXX shared library CMakeFiles/CMakeRelink.dir/libWeatherAPI_cpp_eclipse.so
[cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: make[1]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
[cmake]: Install the project...
[cmake]: -- Install configuration: "Release"
[cmake]: -- Installing: C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse/bin/AXCF2152_21.0.3.35554/Release/lib/libWeatherAPI_cpp_eclipse.so
Successfully built the project WeatherAPI_cpp_eclipse for target AXCF2152,21.0.3.35554.
Finished build for all targets

cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" deploy -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_eclipse" -b Release -s"src""
Successfully deployed all files for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_eclipse.
[/code]

First I thought it was a curl problem, so I added it to cmakelist. This solves my previous bug, but I still got the json problem. When trying to add json to the target link in cmake it cannot find it.

[code type="markup"]
################# add link targets ####################################################

find_package(ArpDevice REQUIRED)
find_package(ArpProgramming REQUIRED)
find_package(curl REQUIRED)

target_link_libraries(WeatherAPI_cpp_eclipse PRIVATE ArpDevice ArpProgramming curl)

#######################################################################################

[/code]

Does anybody know what is wrong?

Kind regards,
Kelvin

Comments

  • Hi Kelvin,

    CMake cannot find an nlohmann package, because nlohmann/json is a header-only library and does not have (or need) a cmake package. You do not need to make any changes to the CMakeLists.txt file to use this library.

    This works for me:

    - I included the header file (in my case, in the Program.hpp file):
    #include "nlohmann/json.hpp"
    
    - I used this code from the nlohmann documentation in the Execute method of my Program.cpp:

    using json = nlohmann::json;
    and:

    (I have inserted this as an image because this Forum formats some source code in unusual ways).
    The above code gives a few warnings during compilation, but ends up building OK.

    Does the above code work in your program?

    ~ Martin.

    P.S. there are a number of other issues with your code snippet, unrelated to the json library, but you may be aware of these already:
    1. If this program is instantiated in a cyclic task in PLCnext Engineer, then the code will be executed cyclically, at the period defined by the Task Interval. That might or might not be what you intend.
    2. The curl GetRequest call will block the Task, and (depending on the Task time settings) will probably cause a Task Watchdog error.
    Please let us know in a separate question, if you need help solving these problems.
  • Hi Martin,

    When I use your version the parse function is error free. Thanks!

    Unfortunately when trying to compile is still get this error messages. All the 'In file included' are marked red:
    cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" generate code -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2" -s"src""
    Generating all files with the 'code' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_v2.
    Successfully generated all files with the 'code' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_v2.
    
    cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" generate config -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2" -s"src""
    Generating all files with the 'config' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_v2.
    Successfully generated all files with the 'config' generator for C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_v2.
    
    cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" build -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2" -b Release"
    Requested build for targets AXCF2152,21.0.3.35554
    Starting build for target AXCF2152,21.0.3.35554
    Checking if CMake needs to be reconfigured...
    [cmake]: 
    [cmake]: C:\Users\usermait\eclipse-workspace\WeatherAPI_cpp_v2\intermediate\cmake\AXCF2152,21.0.3.35554\Release>set PATH=C:\SDKs\AXCF2152\sysroots\x86_64-pokysdk-mingw32\usr\bin;C:/Users/usermait/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.2.v20210201-0955/jre/bin/server;C:/Users/usermait/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.2.v20210201-0955/jre/bin;C:\TwinCAT\Common64;C:\TwinCAT\Common32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\TDM-GCC-64\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\usermait\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\usermait\AppData\Local\Programs\Python\Python39\;C:\Users\usermait\AppData\Local\Microsoft\WindowsApps;C:\Users\usermait\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Common Files\Hilscher GmbH\TLRDecode;C:\Users\usermait\Downloads\Documents\DevOps\packer_1.6.6_windows_amd64;C:\Users\usermait\.dotnet\tools;C:\Program Files (x86)\Nmap;C:\Program Files\CMake\bin;C:\Program Files\PHOENIX CONTACT\PLCnCLI\;C:\Users\usermait\eclipse\cpp-2021-03\eclipse; 
    [cmake]: make[1]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: Scanning dependencies of target WeatherAPI_cpp_v2
    [cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: [ 12%] Building CXX object CMakeFiles/WeatherAPI_cpp_v2.dir/src/WeatherAPI_v2_Program.cpp.o
    [cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/vector:72,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscReader.hpp:13,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscServerContext.hpp:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceStub.hpp:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceFactory.hpp:9,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Acf/ComponentBase.hpp:10,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Component.hpp:3,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.hpp:5,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.cpp:1:
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::_M_erase(std::vector<_Tp, _Alloc>::iterator) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:171:5: note: parameter passing for argument of type 'std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator' {aka '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >'} changed in GCC 7.1
    [cmake]:   171 |     vector<_Tp, _Alloc>::
    [cmake]:       |     ^~~~~~~~~~~~~~~~~~~
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {nlohmann::detail::value_t}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator' {aka '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >'} changed in GCC 7.1
    [cmake]:   426 |       vector<_Tp, _Alloc>::
    [cmake]:       |       ^~~~~~~~~~~~~~~~~~~
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator' {aka '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >'} changed in GCC 7.1
    [cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:60,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.hpp:2,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.cpp:1:
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h: In member function 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, std::tuple<>}; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> >; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >; _Compare = std::less<void>; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_tree.h:2452:7: note: parameter passing for argument of type 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >, std::less<void>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >'} changed in GCC 7.1
    [cmake]:  2452 |       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
    [cmake]:       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/map:61,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/cppformat/format.h:42,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicFormatter.hxx:7,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/BasicString.hxx:13,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/TypeSystem.h:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Core/Arp.h:19,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.hpp:2,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.cpp:1:
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h: In member function 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = nlohmann::basic_json<>; _Compare = std::less<void>; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h:499:8: note: parameter passing for argument of type 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >, std::less<void>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >'} changed in GCC 7.1
    [cmake]:   499 |    __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h: In member function 'bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::key(nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::string_t&) [with BasicJsonType = nlohmann::basic_json<>]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/stl_map.h:499:8: note: parameter passing for argument of type 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >, std::less<void>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > > >::const_iterator' {aka 'std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >'} changed in GCC 7.1
    [cmake]:   499 |    __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
    [cmake]: In file included from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/vector:72,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscReader.hpp:13,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/RscServerContext.hpp:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceStub.hpp:8,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Rsc/Services/IRscServiceFactory.hpp:9,
    [cmake]:                  from C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext/Arp/System/Acf/ComponentBase.hpp:10,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Component.hpp:3,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.hpp:5,
    [cmake]:                  from C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/src/WeatherAPI_v2_Program.cpp:1:
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc: In member function 'bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]':
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
    [cmake]:   121 |    _M_realloc_insert(end(), std::forward<_Args>(__args)...);
    [cmake]:       |    ^~~~~~~~~~~~~~~~~
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
    [cmake]:   121 |    _M_realloc_insert(end(), std::forward<_Args>(__args)...);
    [cmake]:       |    ^~~~~~~~~~~~~~~~~
    [cmake]: C:/SDKs/AXCF2152/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/c++/9.3.0/bits/vector.tcc:121:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
    [cmake]:   121 |    _M_realloc_insert(end(), std::forward<_Args>(__args)...);
    [cmake]:       |    ^~~~~~~~~~~~~~~~~
    [cmake]: [ 25%] Linking CXX shared library libWeatherAPI_cpp_v2.so
    [cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: [100%] Built target WeatherAPI_cpp_v2
    [cmake]: make[1]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: make[1]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: make[2]: Entering directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: Linking CXX shared library CMakeFiles/CMakeRelink.dir/libWeatherAPI_cpp_v2.so
    [cmake]: make[2]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: make[1]: Leaving directory 'C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/intermediate/cmake/AXCF2152,21.0.3.35554/Release'
    [cmake]: Install the project...
    [cmake]: -- Install configuration: "Release"
    [cmake]: -- Installing: C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2/bin/AXCF2152_21.0.3.35554/Release/lib/libWeatherAPI_cpp_v2.so
    Successfully built the project WeatherAPI_cpp_v2 for target AXCF2152,21.0.3.35554.
    Finished build for all targets
    
    cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI/plcncli.exe" deploy -p"C:/Users/usermait/eclipse-workspace/WeatherAPI_cpp_v2" -b Release -s"src""
    [EngineeringLibraryBuilder]: Error:
    [EngineeringLibraryBuilder]:   An assembly specified in the application dependencies manifest (EngineeringLibraryBuilder.deps.json) was not found:
    [EngineeringLibraryBuilder]:     package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '3.1.2'
    [EngineeringLibraryBuilder]:     path: 'Microsoft.CSharp.dll'
    Deploying library failed!
    

    Do you know what I did wrong?

    Kind regards,
    Kelvin
  • It looks like in both cases (the original and the most recent) the build actually completed OK, but there were some warnings that did not stop the build.

    In the most recent case, it looks like there was a problem with the final step - the creation of the PLCnext Engineer library file. This looks similar to problems we have seen in the past, and can usually be solved by deleting the EngineeringLibraryBuilder directory from the %temp%\.net directory on a Windows PC.

    After fixing that problem and re-building, I think you will find that a PLCnext Engineer library containing your program has been created OK.

    ~ Martin.
Sign In or Register to comment.