List Info

Thread: Jam won't link my c++ app




Jam won't link my c++ app
user name
2007-01-29 14:17:18
Hi,

Jam is trying to link using "cc" to link my c++ .o
files which 
apparently does not include c++ routines.  Why isn't jam
using an 
appropriate linker on my system?

Thank you!

Chris


chrisquinn ~/temp $ cat Jamfile
MAIN prog : test.cpp ;

chrisquinn ~/temp $ cat test.cpp
#include <iostream>

int main() {
   std::cout << "Hi";
   return 0;
}

chrisquinn ~/temp $ jam
...found 11 target(s)...
...updating 2 target(s)...
C++ test.o
Link prog
test.o: In function
`__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x1b): undefined reference to
`std::ios_base::Init::Init()'
test.o: In function `__tcf_0':
test.cpp:(.text+0x64): undefined reference to
`std::ios_base::Init::~Init()'
test.o: In function `main':
test.cpp:(.text+0x86): undefined reference to `std::cout'
test.cpp:(.text+0x8b): undefined reference to
`std::basic_ostream<char, 
std::cha
r_traits<char> >& std::operator<<
<std::char_traits<char> 
 >(std::basic_ostream<c
har, std::char_traits<char> >&, char const*)'
test.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

cc  -o prog  test.o

...failed Link prog ...
...failed updating 1 target(s)...
...updated 1 target(s)...

chrisquinn ~/temp $ jam -v
Jam 2.5rc3. OS=LINUX. Copyright 1993-2002 Christopher
Seiwald.

chrisquinn ~/temp $ uname -a
Linux quinn 2.6.18-gentoo-r5 #1 SMP PREEMPT Sat Dec 23
12:24:50 PST 2006 
i686 In
tel(R) Xeon(TM) CPU 2.40GHz GenuineIntel GNU/Linux

chrisquinn ~/temp $ ls -al
total 16
drwxr-xr-x  2 chris users 4096 Jan 29 12:38 .
drwxr-xr-x 70 chris users 4096 Jan 29 12:38 ..
-rw-r--r--  1 chris users   23 Jan 29 12:38 Jamfile
-rw-r--r--  1 chris users   69 Jan 29 12:35 test.cpp
_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Re: Jam won't link my c++ app
user name
2007-01-29 15:30:52
Le Mon 29/01/2007 à 12:17 Chris Stankevitz à écrit:
> Hi,
> 
> Jam is trying to link using "cc" to link my
c++ .o files which 
> apparently does not include c++ routines.  Why isn't
jam using an 
> appropriate linker on my system?
> 
> Thank you!
> 
> Chris

I agree it's strange.
My solution: just add the following line somewhere (I choose
Jamconfig)

LINK = g++ ;

Hope it is useful, and I'm still waiting for a better
solution.
Mildred
-- 
Mildred       <xmpp:mildredjabber.fr> <http://mildred632.free
.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred6
32.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D
2E2B]

_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming
Re: Jam won't link my c++ app
user name
2007-01-29 15:49:41
Mildred wrote:
> My solution: just add the following line somewhere (I
choose Jamconfig)
> 
> LINK = g++ ;

Mildred,

Thank you, this worked for me.  Strange I do not see this
problem in the 
docs or on google.  I wonder if our systems are
misconfigured.

Chris
_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Re: Jam won't link my c++ app
user name
2007-01-29 16:03:33
At 13:17 2007-01-29, Chris Stankevitz wrote:
>Hi,
>
>Jam is trying to link using "cc" to link my
c++ .o files which
>apparently does not include c++ routines.  Why isn't jam
using an
>appropriate linker on my system?
>
>Thank you!

if I had to guess, it know where your runtime routines are
for C++


>Chris
>
>
>chrisquinn ~/temp $ cat Jamfile
>MAIN prog : test.cpp ;
>
>chrisquinn ~/temp $ cat test.cpp
>#include <iostream>
>
>int main() {
>    std::cout << "Hi";
>    return 0;
>}
>
>chrisquinn ~/temp $ jam
>....found 11 target(s)...
>....updating 2 target(s)...
>C++ test.o
>Link prog
>test.o: In function
`__static_initialization_and_destruction_0(int, int)':
>test.cpp:(.text+0x1b): undefined reference to
`std::ios_base::Init::Init()'
>test.o: In function `__tcf_0':
>test.cpp:(.text+0x64): undefined reference to
`std::ios_base::Init::~Init()'
>test.o: In function `main':
>test.cpp:(.text+0x86): undefined reference to
`std::cout'
>test.cpp:(.text+0x8b): undefined reference to
`std::basic_ostream<char,
>std::cha
>r_traits<char> >& std::operator<<
<std::char_traits<char>
>  >(std::basic_ostream<c
>har, std::char_traits<char> >&, char
const*)'
>test.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
>collect2: ld returned 1 exit status
>
>cc  -o prog  test.o
>
>....failed Link prog ...
>....failed updating 1 target(s)...
>....updated 1 target(s)...
>
>chrisquinn ~/temp $ jam -v
>Jam 2.5rc3. OS=LINUX. Copyright 1993-2002 Christopher
Seiwald.
>
>chrisquinn ~/temp $ uname -a
>Linux quinn 2.6.18-gentoo-r5 #1 SMP PREEMPT Sat Dec 23
12:24:50 PST 2006
>i686 In
>tel(R) Xeon(TM) CPU 2.40GHz GenuineIntel GNU/Linux
>
>chrisquinn ~/temp $ ls -al
>total 16
>drwxr-xr-x  2 chris users 4096 Jan 29 12:38 .
>drwxr-xr-x 70 chris users 4096 Jan 29 12:38 ..
>-rw-r--r--  1 chris users   23 Jan 29 12:38 Jamfile
>-rw-r--r--  1 chris users   69 Jan 29 12:35 test.cpp
>_______________________________________________
>jamming mailing list  -  jammingperforce.com
>http://maillist.perforce.com/mailman/listinfo/jamming

Victor A. Wagner Jr.      http://rudbek.com
The five most dangerous words in the English language:
               "There oughta be a law" 
_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Re: Jam won't link my c++ app
user name
2007-01-29 17:16:52

Victor wrote:
> it know where your runtime routines are

Mildred figured it out.  jam invoked cc for linking when it
should have 
invoked g++.

Chris
_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )