Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Linking statically

Reply
Thread Tools

Linking statically

 
 
T
Guest
Posts: n/a
 
      01-10-2006
Hi,

I haven't involved in C programming for quite a while. I want to confirm
this question but couldn't find in comp.lang.c FAQ, and GCC Frequently
Asked Questions. Anyway, here is the question:

How can I link a lib statically?

Although the question is simple, please answer comprehensively. I.e., what
is the command line format, what is required for the linking.
Specifically, I want to link avcodeccvs & avformat statically while lz is
linked dynamically. how can I do that? This is what I tried:

$ g++ -g -Wall -o lnk-test lnk-test.C -lz -static -lavcodeccvs -lavformat
/usr/bin/ld: cannot find -lavcodec
collect2: ld returned 1 exit status

Please note, this is ok:

$ g++ -g -Wall -o lnk-test lnk-test.C -lavcodec -lavformat -lz

Further, in the libavcodeccvs-dev package, only .so type of libs are provided:

/usr/lib/libavcodec.so
/usr/lib/libavformat.so

please elaborate. Thanks

tong

 
Reply With Quote
 
 
 
 
Michael Mair
Guest
Posts: n/a
 
      01-10-2006
T wrote:
> Hi,
>
> I haven't involved in C programming for quite a while. I want to confirm
> this question but couldn't find in comp.lang.c FAQ, and GCC Frequently
> Asked Questions. Anyway, here is the question:
>
> How can I link a lib statically?


This seems to be a gcc question -> news:gnu.gcc.help
Look into the newsgroup's archives

> Although the question is simple, please answer comprehensively. I.e., what
> is the command line format, what is required for the linking.
> Specifically, I want to link avcodeccvs & avformat statically while lz is
> linked dynamically. how can I do that? This is what I tried:
>
> $ g++ -g -Wall -o lnk-test lnk-test.C -lz -static -lavcodeccvs -lavformat
> /usr/bin/ld: cannot find -lavcodec


Note that g++ is used for compilation of C++.
In this case, ask in news:gnu.g++.help


Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
 
Reply With Quote
 
 
 
 
T
Guest
Posts: n/a
 
      01-10-2006
On Tue, 10 Jan 2006 23:52:40 +0100, Michael Mair wrote:

> T wrote:
>> How can I link a lib statically?

>
> Note that g++ is used for compilation of C++. In this case, ask in
> news:gnu.g++.help


Hi, sorry to have posted OT question here. I re-posted it again in
gnu.g++.help.

However, by taking a look at the recent posts, I get a feeling that the NG
is abandoned, and is full of spams. Check the subject list (and count)
below.

> This seems to be a gcc question -> news:gnu.gcc.help Look into the
> newsgroup's archives


As I said, I searched and looked before raised the question.

thank
tong

PS.

Latest headers in gnu.g++.help (count subject)
1
3 (no subject)
1 A LETTER FROM EURO MILLIONS
1 ADAMS SMITH(NEW YEAR AWARD)
1 AWARD CLAIM !!!
1 AWARD NOTICE FROM MRS. MARY VAN ANDER.
2 AWARD WINNING NOTIFICATION / YOU HAVE WON AN E-MAIL LOTTERY.
1 Account Suspended
1 Alert - S.H. Information
1 Banco Central
1 Be the "biggest" out of all your friends
1 Buy OEM Software
2 CHRIST: THE ARRIVAL
1 CONTACT YOUR AGENT.
1 CONTACT YOUR CLAIM AGENT.
1 CONTACT YOUR CLAIMS AGENTS TO VERIFY YOUR LOTTERY WINNING
1 CONTACT YOUR FIDUCIARY AGENT.
1 CONTACT!!!
1 Cialis Soft Tabs bestseller
1 Compile error with concept_check.h
1 Confirm Mail
1 Congratulatio your mail have won!.
2 Corel Draw
1 EMAIL NOTICE!! CONTACT FUDICIAL AGENT ASAP
1 Error message of pointer of type `void *' used in arithmetic in g++
1 Euromillion Loteria Español AWARD 2005.
1 FINAL NOTICE
1 FROM THE PROMOTIONAL MANAGER
1 Finally, you can afford software by Symantec Microsoft & Photoshop
1 Formatted output with std::basic_ostream
1 From The Desk of Mrs.F.Demellor
1 GNU gcc/g++ cross-compiler for PowerPC
1 Geschäft Antrag
1 Grokking C++ errors
3 INTERNET NETHERLANDS EMAIL PROMOTION AWARD
1 INVESTMENT BANKING IN HONGKONG.
1 Important
2 International Promotions
1 Is a gnu object file like an other compiler object file
1 LET'S GO INTO THIS TOGETHER
1 LOTTO.NL.
1 Linker problem
2 Mesage from ebay member
1 Message from eBay Member
1 Mrs. Mercy Steve/Lottery Coordinator
2 Mrs.Pareson Molburg.Prize Claim
4 My.
1 NETHERLANDS EMAIL PROMOTION AWARD
1 NETHERLANDS EMAIL PROMOTION AWARDS
1 NEW YEAR WINNERS.
2 NOTICE OF CONSULATION PRIZE WINNING
1 NOTIFICATION
2 Need S0ftware?
1 New AutoSurf (PAYING)
1 Notification of Limited Account Access
1 Notification of e-gold account update
1 OEM Adobe, Windows software @ wholesale price$
1 Off topic - To be ignored
1 PayPal Account Suspension Notice - PayPal Account Limited
1 Photoshop, Windows, Office
1 Please Protect Your Identity And Update
3 Please Update Your Account Access
1 Please Update Your PayPal Account!
1 Printed information
1 Question from eBay member
2 Question from ebay member
1 READ THIS MAIL YOU JUST WON !!!
2 REFERENCE AND BATCH NUMBER TO FIDUCIARY
2 REQUESTING A BUSINESS RELATIONSHIP
1 RESULTS OF WINNINGS CONTACT YOUR AGENT.
1 ReferenceNumber: 7334NFJF/UDDFMF/NDDD
1 Resolution Center Your account is limited
1 Security Tip: Prevent unautorized access to your account!
1 Security Update Notification
1 Security update
4 Software At Low Pr1ce
1 Sonorisation et effets lumiÉres Á prix discount
1 Spyware a problem?
1 THE NETHERLANDS EMAIL PROMOTION
1 THE NETHERLANDS EMAIL PROMOTION,
1 Test post please ignore.
1 Three Steps to the Software You Need at the Prices You Want
1 US$500,000.00 (Five Hundred Thousand US DOLLARS ) AWARD
2 Update your information
1 WARNING: Your paypal account has been frozen. for Security reasons please Log-in & update your info.
2 WINNING NOTIFICATION/FINAL AWARD.
1 We cure any desease!
1 What IS 0EM Software And Why D0 You Care?
1 YOUR PERUSAL.
2 Your Account Will Be Suspended
1 Your eBay Billing Information is out of date
1 ambiguity and 0
3 eBay Security Center
1 gcc vs g++
1 hiii
1 melhore a sua auto estima 2006
1 operators << and >> for 'std::streampos'
1 please,be my partner
1 std::streampos and INT_MAX - incompatible?
1 www.mundonumismatico.com Monedas del Mundo
1 you really should read this

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-10-2006
T <> writes:
> On Tue, 10 Jan 2006 23:52:40 +0100, Michael Mair wrote:
>> T wrote:
>>> How can I link a lib statically?

>>
>> Note that g++ is used for compilation of C++. In this case, ask in
>> news:gnu.g++.help

>
> Hi, sorry to have posted OT question here. I re-posted it again in
> gnu.g++.help.
>
> However, by taking a look at the recent posts, I get a feeling that the NG
> is abandoned, and is full of spams. Check the subject list (and count)
> below.
>
>> This seems to be a gcc question -> news:gnu.gcc.help Look into the
>> newsgroup's archives

>
> As I said, I searched and looked before raised the question.
>
> thank
> tong
>
> PS.
>
> Latest headers in gnu.g++.help (count subject)
> 1
> 3 (no subject)
> 1 A LETTER FROM EURO MILLIONS
> 1 ADAMS SMITH(NEW YEAR AWARD)

[94 lines deleted]
> 1 std::streampos and INT_MAX - incompatible?
> 1 www.mundonumismatico.com Monedas del Mundo
> 1 you really should read this


Yeah, well, thanks so much for reposting their spam here.

Your question clearly wasn't about C, and probably wasn't about C++
either. I'm sorry if you're having trouble getting help elsewhere,
but that doesn't mean it's topical here.

There were *some* topical posts there. You might try posting and
seeing if anyone answers. If that doesn't work, there are a number of
gcc-related mailing lists; you can find them with a quick Google
search.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
* Tong *
Guest
Posts: n/a
 
      01-11-2006
On Tue, 10 Jan 2006 23:48:48 +0000, Keith Thompson wrote:

> Your question clearly wasn't about C, and probably wasn't about C++
> either. I'm sorry if you're having trouble getting help elsewhere, but
> that doesn't mean it's topical here.


ok, thanks for clear it up. I'll try elsewhere.

--
Tong

 
Reply With Quote
 
Grumble
Guest
Posts: n/a
 
      01-13-2006
Tong wrote:

> Keith Thompson wrote:
>
>> Your question clearly wasn't about C, and probably wasn't about
>> C++ either. I'm sorry if you're having trouble getting help
>> elsewhere, but that doesn't mean it's topical here.

>
> ok, thanks for clear it up. I'll try elsewhere.


Try the gcc-help mailing list.
http://gcc.gnu.org/ml/gcc-help/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Statically linking" native extensions. Indigo Casson Ruby 0 05-26-2010 07:29 PM
Statically linking a library problem... oxblood@oxblood.cc C Programming 2 05-30-2004 05:41 PM
statically linking extensions to ruby & ext/Setup Phil Tomson Ruby 0 05-10-2004 06:45 PM
why are overloaded methods statically bound? sticky@texas.net Java 17 11-03-2003 07:33 PM
Statically Linking Libraries LinuxN00b C++ 1 08-06-2003 08:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57