【发布时间】:2020-06-06 06:19:46
【问题描述】:
我正在 Travis CI 中运行构建,在编译过程中,出现此错误。我尝试指定 C++ 编译器并尝试使用 g++,但这导致了更多错误。
$ clang -I ./jsoncpp/include/ -L ./jsoncpp/build/debug/lib -std=c++14 -v test.cpp -o buildtest.exe
...
./IBMWatson.h:79:44: error: cannot pass object of non-trivial type 'std::string'
(aka 'basic_string<char>') through variadic function; call will abort at
runtime [-Wnon-pod-varargs]
curl_easy_setopt(curl, CURLOPT_PASSWORD, apikey); /* Par...
^
./IBMWatson.h:81:39: error: cannot pass object of non-trivial type 'std::string'
(aka 'basic_string<char>') through variadic function; call will abort at
runtime [-Wnon-pod-varargs]
curl_easy_setopt(curl, CURLOPT_URL, url); /* Sets Regio...
^
./IBMWatson.h:104:102: warning: result of comparison against a string literal is
unspecified (use strncmp instead) [-Wstring-compare]
...+ response.length(), &root, &err) || funcName == "returnVoices" || funcN...
...
4 warnings and 4 errors generated.
The command "clang -I ./jsoncpp/include/ -L ./jsoncpp/build/debug/lib -std=c++14 -v test.cpp -o buildtest.exe" exited with 1.
【问题讨论】:
-
试试这个 apikey.c_str(), url.c_str()
-
它可以工作,但现在它输出
undefined reference -
@PySnoo 在
clang选项中使用-lcurl。
标签: c++ clang c++14 travis-ci clang++