[xsde-users] libxsde.a - undefined reference to 'std::ios_base::Init::Init()

Kevin Drake kdrake3 at oswego.edu
Wed Feb 5 12:30:45 EST 2014


I am new to codesynthesis  xsde and have an issue when compiling/linking my
test application with the runtime libxsde.a library that I built. I get the
following errors during the link stage.

'Building target: cpac_message_test.elf'

'Executing target #164 cpac_message_test.elf'

'Invoking: ARM Ltd Windows GCC C++ Linker'

"C:/Freescale/CW MCU
v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++"
@"cpac_message_test.args"
-o"cpac_message_test.elf"

C:/xsde/xsde-3.2.0/libxsde/xsde/libxsde.a(ro-string.o): In function
`_GLOBAL__sub_I__ZN4xsde3cxx9ro_string4nposE':

ro-string.cxx:(.text.startup+0xc): undefined reference to
`std::ios_base::Init::Init()'

ro-string.cxx:(.text.startup+0x2c): undefined reference to
`std::ios_base::Init::~Init()'

C:/xsde/xsde-3.2.0/libxsde/xsde/libxsde.a(exceptions.o): In function
`_GLOBAL__sub_I__ZN4xsde3cxx10serializerlsERSoRKNS1_9exceptionE':

exceptions.cxx:(.text.startup+0xc): undefined reference to
`std::ios_base::Init::Init()'

exceptions.cxx:(.text.startup+0x2c): undefined reference to
`std::ios_base::Init::~Init()'

collect2.exe: error: ld returned 1 exit status



I have researched the problem and have ruled out the usual mistakes like
using gcc instead of g++ or not using g++ linker. Below are the steps and
background of how I proceeded to this point. Any direction or advice that
can be provide to give me additional things to try would be most
appreciated.



1.       I am using an ARM cross compiler with a Linux target and modified
the xsde "config.make" file as the snippet below shows. Note, I did a "make
clean" after updating config.make and then proceeded with issuing a "make"
to rebuild all files.

CC       := arm-none-eabi-gcc

CFLAGS   := -W -Wall -O3

CPPFLAGS :=



CXX      := arm-none-eabi-g++

CXXFLAGS := -W -Wall -O3



LD       := $(CXX)

LDFLAGS  := $(CXXFLAGS)

LIBS     :=



# Optional post-link command. The first argument to this command is

# the executable name and the rest of the arguments are the object

# files and libraries that were used to link this executable.

#

POSTLD   :=



# Set RANLIB to empty if your system does not need ranlib.

#

AR       := ar

ARFLAGS  := rc

RANLIB   := ranlib





# Common XSD/e flags.

#

XSDFLAGS := --generate-inline





# Platform. Valid values are:

#

# 'wince'  - Windows CE

# 'win32'  - Windows 2000, XP, etc.

# 'posix'  - POSIX OS, including UNIX/Linux, VxWorks, etc.

#

XSDE_PLATFORM     := posix



2.       I generated my parser/serializer code from my schema using the
following command

xsde cxx-hybrid --no-long-long --generate-aggregate --generate-parser
--generate-serializer -output-dir ..\..\Binding ..\..\XmlSchema\*.xsd



3.       I'm using codewarrior as an Eclipse IDE and imported the include
and source files into my project



4.       Added the include path for my imported files, the xsde library
path, and the libxsde.a to the list of libraries



5.       Ensured that I included libstdc++ in my linker arguments. The full
list of libraries is listed below.

-lgcc -lc -lrt -lm -lc++ -lsupc++ -lstdc++ -lhosted -lxsde



6.       Within the codewarrior IDE I performed a "Clean Project" followed
by a "Build Project" to ensure a full rebuild and link. The errors listed
above containing the undefined references were the result.



Again, any advice that can be provided to help me past this issue would be
much appreciated.



Regards,

Kevin Drake


More information about the xsde-users mailing list