我在我的项目中使用这些库
\n\n并使用编译我的项目
\n\ng++ -std=c++1y -I ../../date main.cpp -lpthread -lsqlpp-mysql -lmysqlclient -lboost_system -ljson11\n
Run Code Online (Sandbox Code Playgroud)\n\n直到昨天为止,每天都运行得很好。但现在我收到这个错误,
\n\n\xe2\x94\x8c\xe2\x94\x80[shravan40@Debian] - [~/Work/algorithm] - [Fri Nov 18, 18:33]\n\xe2\x94\x94\xe2\x94\x80[$] <git:(riskProfiling*)> g++ -std=c++1y -I ../../date main.cpp -lpthread -lsqlpp-mysql -lmysqlclient -lboost_system -ljson11\n/usr/bin/ld: //usr/local/lib/libsqlpp-mysql.a(connection.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5\' can not be used when making a shared object; recompile with -fPIC\n/usr/bin/ld: //usr/local/lib/libsqlpp-mysql.a(prepared_statement.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5\' can not be used when making a shared object; recompile with -fPIC\n/usr/bin/ld: //usr/local/lib/libsqlpp-mysql.a(char_result.cpp.o): relocation R_X86_64_32 against `.rodata\' can not be used when making a shared object; recompile with -fPIC\n/usr/bin/ld: //usr/local/lib/libsqlpp-mysql.a(bind_result.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5\' can not be used when making a shared object; recompile with -fPIC\n/usr/bin/ld: //usr/local/lib/libsqlpp-mysql.a(connection_handle.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5\' can not be used when making a shared object; recompile with -fPIC\n/usr/bin/ld: final link failed: Nonrepresentable section on output\ncollect2: error: ld returned 1 exit status\n\xe2\x94\x8c\xe2\x94\x80[shravan40@Debian] - [~/Work/algorithm] - [Fri Nov 18, 18:53]\n\xe2\x94\x94\xe2\x94\x80[$] <git:(riskProfiling*)> \n
Run Code Online (Sandbox Code Playgroud)\n
最后,我找到了解决方案。
原来是版本的问题g++
。最近的版本g++-5
有g++-6
这样的问题,但是当我回到旧g++
版本时4.9.2
,一切都运行顺利。