News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

static linking in codeblocks

Started by mbu, June 14, 2008, 03:27:06 PM

Previous topic - Next topic

mbu

Hi,

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

Thanks, mbu.

mbu


mdurham

So what is the answer, I can't see any way of doing it?
Cheers, Mike

ulrichard

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

gryphon

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>

ulrichard

thanks gryphon.

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

Rgds
Richard