At 21 Jun 2006 06:50:49 -0700 "Mateusz Krzeszowiec" <[EMAIL PROTECTED]> wrote:
> > > Paul Pluzhnikov wrote: > > "facedancer" <[EMAIL PROTECTED]> writes: > > > > > I'm trying to learn c++ for Linux and I've got a big problem. > > > > Actually, you don't have a problem ... > > Actually, I have a problem :) > > I *need* to use shared libs (SDL & openGl libs) and I guess it's > -shared switch which set that 'linking option'. Every time I use it > (-shared) ANY program I'm trying to run gives 'Segmentation fault'... > > Yours > poor noob :) The '-shared' option is for *creating* a shared library only, NOT for linking a *program* to one -- you *NEVER* use -shared when you are creating a *program*. You use the -L and -l options to link with libraries, both shared and static actually, depending on which is available and depending on the presence or absence of the -static switch. The -static forces a static link and is NOT the 'obverse' of -shared -- DON'T be confused by their adjacent placement in the man pages. With modern O/Ss, the default is to link to the shared library (lib<mumble>.so), unless one is not available. So to link with the shared libraries, you don't need any *extra* switches to 'force' linking with the shared libraries -- it will happen automagically by default. You just need to specify the library names. If you are discovering that you are NOT linking to the shared libraries you thought you were going to link with there is something else going on, like maybe the shared libraries are not installed in the proper place or not installed at all. You might need to include a -L<path> option before the -l<lib> option or something. You don't add the '-shared' option. So what you want is (assuming you are wanting libSDL.so and libGL.so): g++ -o otestSDLa testSDLa.o -lSDL -lGL or maybe g++ -o otestSDLa testSDLa.o -L/usr/local/lib -lSDL -lGL or something like that. -- Robert Heller -- 978-544-6933 Deepwoods Software -- Linux Installation and Administration http://www.deepsoft.com/ -- Web Hosting, with CGI and Database [EMAIL PROTECTED] -- Contract Programming: C/C++, Tcl/Tk _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus