[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c++ cross compiling for 32 bit

From: Robert Heller
Subject: Re: c++ cross compiling for 32 bit
Date: Thu, 08 Mar 2007 23:13:09 +0100

At 8 Mar 2007 10:01:14 -0800 "Bert" <> wrote:

> Hi,
> I'm trying to find the right cc and linker flags to generate a 32-bit
> version of my program.  My environement is SuSE 10.2 Linux on a 64-bit
> computer.  I try "gcc -m32 hello.cpp -o hello" (hello world program)
> and get the following errors:
> hello.cpp:(.text+0x27): undefined reference to `std::cout'
> hello.cpp:(.text+0x2c): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
> <std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&, char const*)'
> /tmp/ccbr0Ju1.o: In function `__tcf_0':
> hello.cpp:(.text+0x46): undefined reference to
> `std::ios_base::Init::~Init()'
> /tmp/ccbr0Ju1.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> hello.cpp:(.text+0x6f): undefined reference to
> `std::ios_base::Init::Init()'
> /tmp/ccbr0Ju1.o:(.eh_frame+0x11): undefined reference to
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
> Any advice on what libraries I'm missing or how to point the linker to
> the correct libraries?

By default, most (all?) of the 64-bit x86 Linux distros only include
the 64-bit development packages.  Generally, installing both the 64-bit
and 32-bit development tools and build chain *in the distro system
locations* (eg via the distro RPMs) causes massive system confusion
(and you should not do this). It might be easiest to just set up your
system as a dual boot system (64 and 32 bit), with separate root, /usr,
and /var partitions (/home can be shared) install OR install vmware
and install a 32-bit version of your distro in a virtual machine.

> Thanks

Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration  -- Web Hosting, with CGI and Database       -- Contract Programming: C/C++, Tcl/Tk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]