Buchan Milne on Mon, 03 Mar 2003 00:14:05 +0200 (SAST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Linux dev] Re: Static C++ (wxWindows libs)


On Sun, 2 Mar 2003, Paul Surgeon wrote:

> I'm not sure what wx-config does but by default gcc uses shared libraries so
> if you really need to link against static libraries you need to use the
> -static flag.
>
> eg.
> $ gcc prog.cpp -lmystaticlib -static -o prog
>
> Paul
>
>
> On Sunday, 2 March 2003 20:54, Jens Thiede wrote:
> > Hello,
> >
> > How do you link a wxWindows C++ program statically?
> >
> > $ gcc prog.cpp `wx-config --libs --cflags` -o prog
> >
> > What else should I do to the line above?
> >
> > Any help appreciated,
> >
> > Jens.

It might also be necessary to compile wxWindows/wxGTK as a static library.
IIRC, it is an option in the configure script for wxWindows/wxGTK.

On my Mandrake 9.0 box, -static does not work with wxGTK, on my Windows
box, I think I compiled wxWindows static, and there I only get static
binaries ...

Note that you may end up with pretty large binaries ;-).

Regards,
Buchan

-- 
|----------------Registered Linux User #182071-----------------|
Buchan Milne                Mechanical Engineer, Network Manager
Cellphone * Work            +27 82 472 2231 * +27 21 8828820x121
Stellenbosch Automotive Engineering         http://www.cae.co.za
GPG Key                   http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7