我有一段代码使用cURL
访问数据并将其打印为字符串。这部分工作正常。我需要使用此字符串并使用Jsoncpp
对其进行解析。但是,当我添加这一行时:
Json::Value json_data;
存在运行时错误:
libjsoncpp.so.20: cannot open shared object file: No such file or directory
我的CMakeLists.txt
如下所示(注释掉的行是我尝试的内容):
cmake_minimum_required(VERSION 3.5.1)
project(imu_data_access_class)
set(CMAKE_CXX_STANDARD 11)
find_package(CURL REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP jsoncpp)
#link_libraries(${JSONCPP_LIBRARIES})
#set(INCLUDE_DIRS ${JSONCPP_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS})
#set(INCLUDE_DIRS /usr/local/include ${CURL_INCLUDE_DIRS})
#include_directories(${INCLUDE_DIRS})
set(SOURCES imu_data_access_class.cpp ${CURL_INCLUDE_DIRS}/curl/curl.h)
add_executable(imu_data_access_class ${SOURCES})
#target_include_directories(imu_data_access_class PUBLIC ${Jsoncpp_INCLUDE_DIRS})
set(LIBS ${JSONCPP_LIBRARIES} ${CURL_LIBRARIES})
target_link_libraries(imu_data_access_class ${LIBS})
请帮助解决此错误。
编辑1:cmake输出:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CURL: /usr/lib/aarch64-linux-gnu/libcurl.so (found version "7.47.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'jsoncpp'
-- Found jsoncpp, version 1.8.4
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/ws/imu_data_access_class