[Log4cplus-devel] [log4cplus:bugs] #344 liblog4cplus. a linux library - compilation for std=c++11
Logging Framework for C++
Brought to you by:
wilx
|
From: Václav H. <wi...@us...> - 2019-07-29 16:39:29
|
- Description has changed:
Diff:
~~~~
--- old
+++ new
@@ -2,17 +2,20 @@
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<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)':
2>\usr\include\c++\5\bits\basic_string.tcc(223): error : undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_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<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
2>\usr\include\c++\5\bits\basic_string.h(589): error : undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
-
+```
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")
This are the parts from configure file which I changed:
+```
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
@@ -101,6 +104,7 @@
CXXFLAGS="-std=c++11"
fi
fi
+```
The commad used to compile the library is:
sudo ./configure --enable-static
~~~~
---
** [bugs:#344] liblog4cplus. a linux library - compilation for std=c++11**
**Status:** open
**Group:** v1.1.3
**Created:** Mon Jul 29, 2019 02:53 PM UTC by Andreea Furnica
**Last Updated:** Mon Jul 29, 2019 02:53 PM UTC
**Owner:** nobody
**Attachments:**
- [configure](https://sourceforge.net/p/log4cplus/bugs/344/attachment/configure) (788.3 kB; text/plain)
Hello,
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<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)':
2>\usr\include\c++\5\bits\basic_string.tcc(223): error : undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_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<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
2>\usr\include\c++\5\bits\basic_string.h(589): error : undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
```
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")
This are the parts from configure file which I changed:
```
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GXX=yes
else
GXX=
fi
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_cv_prog_cxx_g=no
CXXFLAGS="-g -std=c++11"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
else
CXXFLAGS="-std=c++11"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="-g -std=c++11"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
$as_echo "$ac_cv_prog_cxx_g" >&6; }
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2 -std=c++11"
else
CXXFLAGS="-g -std=c++11"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2 -std=c++11"
else
CXXFLAGS="-std=c++11"
fi
fi
```
The commad used to compile the library is:
sudo ./configure --enable-static
The compilation worked well.
I am using the log4cpuls 1.2.1 version and the gcc-5.4.0 version to compile the library.
I think the error from visual studio is related to c++11 compilation.
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 somenthing else?
Please find attached the configure file/
---
Sent from sourceforge.net because log...@li... is subscribed to https://sourceforge.net/p/log4cplus/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/log4cplus/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |