Re: g++ trouble linking against archive
- To: "Red Hat developer's list" <redhat-devel-list@xxxxxxxxxx>
- Subject: Re: g++ trouble linking against archive
- From: exits funnel <exitsfunnel@xxxxxxxxx>
- Date: Wed, 5 Jan 2005 19:06:26 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=GBb8ElUuldLw915+h2lIwqnCBO1XUznGFU3/L3s6JfLoMpICwEVoxKEEax/FHKG8vxfZhm2wgLjEVXvBfHGYbKr0Rkn9Uh1kb8gf1Hr4Tran6v0FTN7wKnccpT17wGtwV780KXt+dZXoEcN19BrMSXv3Ka9y8KafDacQiDjtMiE= ;
- In-reply-to: <Pine.SUN.4.58.0501051324550.25696@eskimo.com>
- Reply-to: "Red Hat developer's list" <redhat-devel-list@xxxxxxxxxx>
Thanks that fixed it. It's funny I don't see this
requirement documented on the info page even after a
reread. Oh well. Thanks again.
-exits
--- Jonathan Bartlett <johnnyb@xxxxxxxxxx> wrote:
> Move -lfun to the end of the command line.
>
> Jon
> ----
> Learn to program using Linux assembly language
> http://www.cafeshops.com/bartlettpublish.8640017
>
>
> On Tue, 4 Jan 2005, exits funnel wrote:
>
> > Hello,
> >
> > I've got the following simple source files:
> >
> > //Begin fun1.cpp
> > #include <iostream.h>
> > void fun1( ) { cout << "Exits in fun1( )\n"; }
> > //End fun1.cpp
> >
> > //Begin fun2.cpp
> > #include <iostream.h>
> > void fun2( ) { cout << "Exits in fun2( )\n"; }
> > //End fun2.cpp
> >
> > //Begin funmain.cpp
> > #include <iostream.h>
> > void fun1( );
> > int main( )
> > {
> > cout << "about to call fun1( )\n";
> > fun1( );
> > cout << "just called fun1( )\n";
> > return 0;
> > }
> > //End funmain.cpp
> >
> > all of the source files are in the directory
> > /home/exits/moment/cpptest. I compile the two
> > functions like this:
> >
> > g++ -c fun1.cpp
> > g++ -c fun2.cpp
> >
> > I then archive the two resulting object files like
> > this:
> >
> > ar -cr libfun.a fun1.o fun2.o
> >
> > So far so good (I think) i've not got my library
> > containing the two functions. I can't seem to
> figure
> > out though how to link my main method agains the
> > archive. It seems this should work:
> >
> > g++ -o fun -L/home/exits/moment/cpptest -lfun
> > funmain.cpp
> >
> > but it doesn't instead g++ complains about an
> > undefined reference to fun1( ). If I just pop the
> .o
> > file on the command line when I compile/link main
> > everything is fine but I really need to get the
> > library stuff working. If anyone could point out
> what
> > I've done wrong, I'd really appreciate it. Thanks
> in
> > advance!
> >
> > -exits
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - You care about security. So do we.
> > http://promotions.yahoo.com/new_mail
> >
> > _______________________________________________
> > Redhat-devel-list mailing list
> > Redhat-devel-list@xxxxxxxxxx
> >
>
https://www.redhat.com/mailman/listinfo/redhat-devel-list
> >
>
> _______________________________________________
> Redhat-devel-list mailing list
> Redhat-devel-list@xxxxxxxxxx
>
https://www.redhat.com/mailman/listinfo/redhat-devel-list
>
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/redhat-devel-list
[Home]
[Kernel Newbies]
[Red Hat General]
[Fedora]
[Red Hat Install]
[Kernel List]
[Yosemite News]