"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 ...

> When I
> try to link shared libraries to my program it always outputs
> 'Segmentation fault' when I try to run it.

You are trying to *run* a library, but libraries aren't "runnable"
on any OS I know of [1].

> Of course I was trying to
> write something a bit more complicated ;) but after looking for a bug I
> removed all code and realized that the bug is not caused my my mistake.

Yes, it is. Your mistake is trying to run something that isn't
intended to run.

> g++ -c -otestSDL.o testSDLa.cpp
> g++ -shared -otestSDLa testSDLa.o
> ./testSDLa
> output: Segmentation fault

Don't do that ... Do this instead:

> g++ -otestSDL.o testSDLa.cpp
g++ -o testSDLa testSDL.o        # looks like you missed a step
> ./testSDLa
> output: ok

Cheers,

[1] Actually, on Linux 2 special libraries are runnable:
ld-linux.so.2 and libc.so.6. This is achieved via special assembly
magic, which is too advanced for a beginner to understand :)
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to