My project uses gflags library, and when I try to include s2/s2polyline.h in one of my project's header file,
I got many link errors like undefined reference to FLAGS_wal_buffer_size.
It confuses me a lot because my project links well before I include s2polyline.h.
Then I find s2polyline.h indirectly includes s2/base/commandlineflags.h:
Because my project's header file indirectly includes this file, and I forget to define macro S2_USE_GFLAGS when compiling s2 library, so this file rewrites gflags related macro like DEFINE_bool in my project. And it cause the link error!
My project uses gflags library, and when I try to include s2/s2polyline.h in one of my project's header file, I got many link errors like
undefined reference to FLAGS_wal_buffer_size
. It confuses me a lot because my project links well before I includes2polyline.h
. Then I finds2polyline.h
indirectly includess2/base/commandlineflags.h
:Because my project's header file indirectly includes this file, and I forget to define macro
S2_USE_GFLAGS
when compiling s2 library, so this file rewrites gflags related macro likeDEFINE_bool
in my project. And it cause the link error!