Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: mbu on June 14, 2008, 03:27:06 pm

Title: static linking in codeblocks
Post by: mbu on June 14, 2008, 03:27:06 pm
Hi,

can anyone please tell me how to statically link a library using codeblocks?

Thanks, mbu.
Title: Re: static linking in codeblocks
Post by: mbu on June 14, 2008, 04:01:45 pm
Has been solved. Thank you.
Title: Re: static linking in codeblocks
Post by: mdurham on January 22, 2009, 12:09:53 pm
So what is the answer, I can't see any way of doing it?
Cheers, Mike
Title: Re: static linking in codeblocks
Post by: ulrichard on February 14, 2009, 12:07:20 pm
I'm also looking for a solution to link some libs like boost statically in codeblocks.
If I add -static to "other linker commands" I get an error "-Wl not found" 
I found lots of pages on the internet that tell how to do it on the commandline, but I would like to do it in my codeblocks project.

Rgds
Richard
Title: Re: static linking in codeblocks
Post by: gryphon on February 14, 2009, 02:09:23 pm
Either use the full libray name in the Link Libraries section on the Linker Settings tab, for example:

../../../../thirdparty/boost/lib/libboost_date_time-gcc42-mt.a

or don't use the Link Libraries at all and manually enter your linker settings in the 'Other Linker Options...' window using the -Xlinker. For example,


-Xlinker -Bstatic
-l<some_boost_static_library>
-l<more_static_libraries>
-Xlinker -Bdynamic
-lpthread
-l<more_dynamic_libraries>
Title: Re: static linking in codeblocks
Post by: ulrichard on February 15, 2009, 12:42:54 am
thanks gryphon.

I'm one step further now, and understand a bit more how these things work under linux and codeblocks.

Rgds
Richard