今天,当尝试使用mongodb c ++客户端构建我的lib项目时,我得到了错误:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../libmongoclient.a(connection_factory.o): relocation R_X86_64_32S against `_ZTVN5mongo17AScopedConnectionE' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../libmongoclient.a: error adding symbols: Bad value clang: error: linker command failed with exit code 1 (use -v to see invocation)
我用google搜索-fPIC,但什么也没得到.我在哪里可以找到关于此的文档?这是什么?我正在使用clang ++进行构建.