help-gplusplus
[Top][All Lists]
Advanced

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

using 'g++ -shared' causes Segmentation fault


From: facedancer
Subject: using 'g++ -shared' causes Segmentation fault
Date: 20 Jun 2006 17:33:43 -0700
User-agent: G2/0.2

Heya

First of all I'm totally Linux development newbie.

I'm trying to learn c++ for Linux and I've got a big problem. When I
try to link shared libraries to my program it always outputs
'Segmentation fault' when I try to run it. 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.

Sample code:
[code]
#include <stdio.h>

int main() {
        printf("ok");
        return 0;
}
[/code]

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

g++ -otestSDL.o testSDLa.cpp
./testSDLa
output: ok

gcc version: gcc-4.1.1-1.fc5

thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]