Linking problesm with boost/format.hpp

Hello, I'm been developing an application on SUSE 9.3, gcc 3.3.5 and within my makefile I have the following for the CPPFLAGS "-g -O0" and the code complied and linked fine. I reached the end of the development and decided to up the optimisation so I changed the line to "-O2" and removed the "-g". When I got the linking stage I got the following error: /usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: `.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh' referenced in section `.rodata' of sg_gui_export_dialog.o: defined in discarded section `.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh' of sg_gui_export_dialog.o For what I can figure out its complaining about boost. I got the above error for 4 files and within all 4 files I use the "<boost/format.hpp>" library. I have used other boost libraries in other files but the linker didn't complain about them it was only the files where I used "format.hpp". I had a play around and if the CPPFLAGS line within the makefile and if it reads "-g -O2" then it links fine but if I don't have the "-g" it comes up with error above. Does anyone have any clue as to what I'm doing wrong? Thanks, Kiran -- View this message in context: http://www.nabble.com/Linking-problesm-with-boost-format.hpp-tf3876852.html#... Sent from the Boost - Users mailing list archive at Nabble.com.

ronnie_raj wrote:
Hello, I'm been developing an application on SUSE 9.3, gcc 3.3.5
.....
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: `.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh' referenced in section `.rodata' of sg_gui_export_dialog.o: defined in discarded section `.gnu.linkonce.t._ZN5boost2io6detail22parse_printf_directiveIcSt11char_traitsIcESaIcEN9__gnu_cxx17__normal_iteratorIPKcSsEESt5ctypeIcEEEbRT2_RKSD_PNS1_11format_itemIT_T0_T1_EERKT3_jh' of sg_gui_export_dialog.o
I believe the problem is that your gcc is too old, your binutils are too new, and this results in this error for any non-trivial C++ code. Searching gcc bugzilla will give you the exact bug report, but I don't know any workarounds except for: 1. Using newer gcc like 4.* 2. Using older binutils (like maybe 2.13, but I don't remember exactly) - Volodya
participants (2)
-
ronnie_raj
-
Vladimir Prus