userMacBook:c++ user$ find /usr/local -name "xdevapi.h" -print
/usr/local/mysql-connector-c++-8.0.13/include/mysqlx/xdevapi.h |
userMacBook:c++ user$ clang++ -v MySqlConn.cpp
, I get the following search directories:#include "..." search starts here: #include <...> search starts here: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. MySqlConn.cpp:2:10: fatal error: 'mysqlx/xdevapi.h' file not found #include <mysqlx/xdevapi.h> ^~~~~~~~~~~~~~~~~~ 1 error generated. |
clang++ -Lusr/local/mysql-connector-c++-8.0.13-dynamiclib/include MySqlConn.cpp -o libMySql.dylib
, I still get:MySqlConn.cpp:2:10: fatal error: 'mysqlx/xdevapi.h' file not found #include <mysqlx/xdevapi.h> ^~~~~~~~~~~~~~~~~~ 1 error generated. |
|
|
In file included from MySqlConn.cpp:2: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/xdevapi.h:91: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/common.h:35: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/../common.h:49: /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:217:62: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<std::is_unsigned<U>::value>::type* = nullptr ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:222:14: warning: alias declarations are a C++11 extension [-Wc++11-extensions] using UT = typename std::make_unsigned<T>::type; ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:228:62: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr, ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:229:63: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<!std::is_unsigned<U>::value>::type* = nullptr ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:239:63: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<!std::is_unsigned<T>::value>::type* = nullptr, ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:240:63: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<!std::is_unsigned<U>::value>::type* = nullptr ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:291:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions] nocopy(const nocopy&) = delete; ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:292:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions] nocopy& operator=(const nocopy&) = delete; ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:326:14: warning: alias declarations are a C++11 extension [-Wc++11-extensions] using It = typename CONT::iterator; ^ In file included from MySqlConn.cpp:2: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/xdevapi.h:91: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/common.h:35: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/../common.h:50: /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:97:35: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] void print(std::ostream&) const override; ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:100:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions] Value(Type type, T &&init) ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:155:64: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:163:65: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<!std::is_unsigned<T>::value>::type* = nullptr, ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:164:64: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions] typename std::enable_if<std::is_integral<T>::value>::type* = nullptr ^ ~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:283:10: warning: unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'mysqlx::common::Value_conv' [-Wc++11-extensions] friend Value_conv; ^ class /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:286:10: warning: unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'mysqlx::common::Value::Access' [-Wc++11-extensions] friend Access; ^ struct /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:158:7: error: delegating constructors are permitted only in C++11 : Value(uint64_t(val)) ^~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:167:7: error: delegating constructors are permitted only in C++11 : Value(int64_t(val)) ^~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/value.h:210:10: error: no matching function for call to 'check_num_limits' if (!check_num_limits<int64_t>(val)) ^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:220:6: note: candidate template ignored: substitution failure [with T = long long, U = unsigned long long]: non-type template argument does not refer to any declaration bool check_num_limits(U val) ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:232:6: note: candidate template ignored: requirement 'std::is_unsigned<long long>::value' was not satisfied [with T = long long, U = unsigned long long] bool check_num_limits(U val) ^ /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/common/util.h:243:6: note: candidate template ignored: substitution failure [with T = long long, U = unsigned long long]: non-type template argument does not refer to any declaration bool check_num_limits(U val) ^ In file included from MySqlConn.cpp:2: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/xdevapi.h:91: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/common.h:35: In file included from /usr/local/mysql-connector-c++-8.0.13/include/mysqlx/devapi/../common.h:51: |
fatal error: too many errors emitted, stopping now [-ferror-limit=] 96 warnings and 20 errors generated. |
clang++ -std=c++11
, and clang++ -std=c++17
. I have version clang-1000.11.45.5:UserMacBook:c++ user$ clang++ --version Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix |
clang++ -std=c++17 -I /usr/local/mysql-connector-c++-8.0.13/include -L /usr/local/mysql-connector-c++-8.0.13/lib64 MySqlConn.cpp -lmysqlcppconn8 -o libMySql
Should I drop the lib initials when I am linking to a library using flag -l? |
gccmanual wrote: |
---|
3.14 Options for Linking -l library Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.) It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file foo.o but before bar.o. If bar.o refers to functions in ‘z’, those functions may not be loaded. The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name. The directories searched include several standard system directories plus any that you specify with -L. Normally the files found this way are library files—archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l surrounds library with ‘lib’ and ‘.a’ and searches several directories. |
What standard does it use when I don't specify std=c++XX? |