For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Segmentation Fault in a Simple Program

Ari Gasmi's picture

Hello,

I am trying to run the following simple program. I work on SUSElinux 13.1 and
I install "/usr/lib/oce/" library and "/usr/include/oce/" header files using my Package Manager and so I didn't compile OpenCascade source code. So anyways, this is my simple program:

#include
#include
#include
#include
#include

int main()
{

double myWidth = 1.0, myThickness = 0.5;

// Profile : Define Support Points
gp_Pnt aPnt1(-myWidth / 2., 0, 0);
gp_Pnt aPnt2(-myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt3(0, -myThickness / 2., 0);
gp_Pnt aPnt4(myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt5(myWidth / 2., 0, 0);

// Profile : Define the Geometry
Handle(Geom_TrimmedCurve) anArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4);
Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2);
Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5);
printf("\n So far OK!\n");

return 0;
}

I compile and link it using:

$> g++ my_sample.cxx -I/usr/include/oce/ /usr/lib/oce/lib*

So I include all libraries since I exactly don't know which class is in which library. This compiles and linkes fine and I can see the code runs through "So far OK!". But I have a "Segmentation Fault" too. As long as I add all libraries, I get this annoying segfault problem. Do you have any idea? Thank you

Arash

Aris Karagiannidis's picture

Hello Arash. Can you run the program through GDB? See a backtrace and the stack of function calls. Maybe we can pinpoint the problem.