c++sdk在linux上的构建问题
花火free4 发布于2020-03 浏览:3065 回复:2
1
收藏

我试图在linux下接入c++的baidu ai sdk;

按照官方文档 我安装并依赖了jsoncpp,curl,openssl。并编写了一个cmakelist.txt.

在执行make后,收到来自base.h中#include的报错,见于#errorpage

完整的cmakelist。txt我贴在最后。

百度了一下说是c++跟MYSQL 发生冲突,我不知道如何解决。恳请大神帮帮忙。跟我比较像的问题在网上我也找到了一个:https://gcc.gnu.org/legacy-ml/gcc-help/2004-06/msg00159.html

#errorpage
Scanning dependencies of target AI
[ 50%] Building CXX object CMakeFiles/AI.dir/pj1.cpp.o
In file included from /usr/include/c++/7/bits/localefwd.h:42:0,
                 from /usr/include/c++/7/string:43,
                 from /usr/include/c++/7/stdexcept:39,
                 from /usr/include/c++/7/array:39,
                 from /usr/include/c++/7/tuple:39,
                 from /usr/include/c++/7/bits/unique_ptr.h:37,
                 from /usr/include/c++/7/memory:80,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/../base/base.h:18,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/../image_classify.h:19,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/pj1.cpp:1:
/usr/include/c++/7/cctype:64:11: error: ‘::isalnum’ has not been declared
   using ::isalnum;
           ^~~~~~~
/usr/include/c++/7/cctype:65:11: error: ‘::isalpha’ has not been declared
   using ::isalpha;
           ^~~~~~~
/usr/include/c++/7/cctype:66:11: error: ‘::iscntrl’ has not been declared
   using ::iscntrl;
           ^~~~~~~
/usr/include/c++/7/cctype:67:11: error: ‘::isdigit’ has not been declared
   using ::isdigit;
           ^~~~~~~
/usr/include/c++/7/cctype:68:11: error: ‘::isgraph’ has not been declared
   using ::isgraph;
           ^~~~~~~
/usr/include/c++/7/cctype:69:11: error: ‘::islower’ has not been declared
   using ::islower;
           ^~~~~~~
/usr/include/c++/7/cctype:70:11: error: ‘::isprint’ has not been declared
   using ::isprint;
           ^~~~~~~
/usr/include/c++/7/cctype:71:11: error: ‘::ispunct’ has not been declared
   using ::ispunct;
           ^~~~~~~
/usr/include/c++/7/cctype:72:11: error: ‘::isspace’ has not been declared
   using ::isspace;
           ^~~~~~~
/usr/include/c++/7/cctype:73:11: error: ‘::isupper’ has not been declared
   using ::isupper;
           ^~~~~~~
/usr/include/c++/7/cctype:74:11: error: ‘::isxdigit’ has not been declared
   using ::isxdigit;
           ^~~~~~~~
/usr/include/c++/7/cctype:75:11: error: ‘::tolower’ has not been declared
   using ::tolower;
           ^~~~~~~
/usr/include/c++/7/cctype:76:11: error: ‘::toupper’ has not been declared
   using ::toupper;
           ^~~~~~~
/usr/include/c++/7/cctype:87:11: error: ‘::isblank’ has not been declared
   using ::isblank;
           ^~~~~~~
In file included from /usr/include/c++/7/bits/locale_facets.h:41:0,
                 from /usr/include/c++/7/bits/basic_ios.h:37,
                 from /usr/include/c++/7/ios:44,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/../base/http.h:20,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/../base/base.h:20,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/../image_classify.h:19,
                 from /home/shen/Documents/baidu_ai/aip_cpp/pj2/pj1.cpp:1:
/usr/include/x86_64-linux-gnu/c++/7/bits/ctype_base.h:49:35: error: ‘_ISupper’ was not declared in this scope
     static const mask upper     = _ISupper;
                                   ^~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/ctype_base.h:49:35: note: suggested alternative: ‘_ISwupper’
     static const mask upper     = _ISupper;
                                   ^~~~~~~~
# cmake needs this line
cmake_minimum_required(VERSION 2.8)

# Define project name
project(AI)

# Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI

aux_source_directory(. DIR_SRCS)
# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.



include_directories(..)
message(STATUS "    include path: ..")
find_package(CURL REQUIRED)
if(CURL_FOUND)
message("found_curl")
endif()
include_directories(${CURL_INCLUDE_DIR})
link_directories(${CURL_LIBRARY_DIR})

#find_package(crypto REQUIRED)
#if(crypto_FOUND)
#message("found_openssl")

#else()
message("not _found_openssl,use set configution")
set(crypto_LIBRARY_DIR ../../openssl)
set(crypto_INCLUDE_DIR ../../openssl/include/crypto)
#endif()
include_directories(${crypto_INCLUDE_DIR})
link_directories(${crypto_LIBRARY_DIR})



find_package(jsoncpp)
if(jsoncpp_FOUND)
message("found_jsoncpp")
endif()

include_directories(${jsoncpp_INCLUDE_DIR})
link_directories(${jsoncpp_LIBRARY_DIR})


# Declare the executable target built from your sources
add_executable(AI ${DIR_SRCS})
target_link_libraries(AI ${CURL_LIBRARY})
target_link_libraries(AI crypto)
target_link_libraries(AI ${jsoncpp_LIBRARY})

# Link your application with OpenCV libraries
#target_link_libraries(AI  ${OpenCV_LIBS})

add_compile_options(-std=c++11)

收藏
点赞
1
个赞
共2条回复 最后由lyoong回复于2021-12
#3lyoong回复于2021-12

楼主你解决了吗 我也遇到一样的问题, 莫名其妙。。

0
#2小马奔特回复于2020-05

具体用的哪个接口能力

0
TOP
切换版块