lundi 29 juillet 2019

compile liblog4cplus.a library with std=c++11

I am using a Visual Studio GDB project and I have a problem including the liblog4cplus. a static library in the linker inputs.

This are the errors received:

....\Dependencies\log4cplus-1.2.1.libs\liblog4cplus.a(liblog4cplus_la-appender.o): In function void std::__cxx11::basic_string, std::allocator >::_M_construct(char*, char*, std::forward_iterator_tag)': 2>\usr\include\c++\5\bits\basic_string.tcc(223): error : undefined reference tostd::cxx11::basic_string, std::allocator >::_M_create(unsigned long&, unsigned long)' 2>......\Dependencies\log4cplus-1.2.1.libs\liblog4cplus.a(liblog4cplus_la-appender.o): In function std::__cxx11::basic_string, std::allocator >::operator=(std::__cxx11::basic_string, std::allocator >&&)': 2>\usr\include\c++\5\bits\basic_string.h(589): error : undefined reference tostd::cxx11::basic_string, std::allocator >::swap(std::__cxx11::basic_string, std::allocator >&)'

It seems that the library is not recognised as being compiled with -std=c++11

In order compile the library with c++11 I added the command -std=c++11 in the configure file(CXXFLAGS = "-std=c++11")

The command used to compile the library is: sudo ./configure --enable-static

The compilation worked well.

This is some part of the configure file if test "$GXX" = yes; then CXXFLAGS="-O2 -std=c++11"

I think the error from visual studio is related to c++11 compilation and after the compilation the error should not be anymore, but still have the same error.

Could you please tell me if the compilation procedure is ok?

If not, please tell which is the right procedure to compile the library for c++11?

Does the errors mean something else?

Aucun commentaire:

Enregistrer un commentaire