0
は私がGFLAGSインストール:は、リンカーエラーをGFLAGS:未定義の参照
$ ls /usr/local/lib/ | grep gflags
libgflags.a
libgflags_nothreads.a
$ ls /usr/local/include/ | grep gflags
gflags
をそして<gflags/gflags.h>
#include <gflags/gflags.h>
DEFINE_bool(a, false, "test");
int main(int argc, char **argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
return 0;
}
を含ましかし、私は、リンカ・エラーを得ました!
$ g++ -lgflags a.cpp
/tmp/cchKYAWZ.o: In function `main':
/home/wonter/gflags-2.2.1/build/a.cpp:6: undefined reference to `google::ParseCommandLineFlags(int*, char***, bool)'
/tmp/cchKYAWZ.o: In function `__static_initialization_and_destruction_0(int, int)':
/home/wonter/gflags-2.2.1/build/a.cpp:3: undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
collect2: error: ld returned 1 exit status
私は$ g++ /usr/local/lib/libgflags.a a.cpp -o test
を試しましたが、同じエラーが発生しました。私のプラットフォームはUbuntu 17.10
ある
、GCCのバージョンはgcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)
があるため、問題の私のGCCのバージョンのそれをですか?