
Thu, 05/31/2012 - 01:16
I am studying OpenCascade and had some difficulties with GC_MakeSegment class.
I send the error and the program below. Any ideas about what´s happening???
The error:
/tmp/ccIDqMyc.o: In function `main':
hello.cpp:(.text+0x197): undefined reference to `GC_MakeSegment::GC_MakeSegment(gp_Pnt const&, gp_Pnt const&)'
/tmp/ccIDqMyc.o: In function `Handle_Standard_Transient::~Handle_Standard_Transient()':
hello.cpp:(.text._ZN25Handle_Standard_TransientD2Ev[_ZN25Handle_Standard_TransientD5Ev]+0xd): undefined reference to `Handle_Standard_Transient::EndScope()'
collect2: ld returned 1 exit status
The program:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
cout
int myHeight = 70;
int myWidth = 50;
int myThickness = 30;
// my 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);
// The error happens here!
GC_MakeSegment mkSeg (aPnt1 , aPnt2);
return 0;
}
Thu, 05/31/2012 - 01:45
Hello, add flags "-lTKGeomBase -lTKernel" (without quotes) when linking.
Thu, 05/31/2012 - 17:30
It worked fine! Thank you!
Is there any tutorial showing how to create .IGES files?
I need to save my geometry using this file format.
Fri, 06/01/2012 - 15:56
Hi Gilles,
have a look on the iges.pdf (3.3.4. Writing the IGES file, page 31)
or on the ImportExport sample.
Or look at the Drawmethod "static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, const char** a)"
at the file \ros\src\XSDRAWIGES\XSDRAWIGES.cxx
Regards
Alex
Fri, 06/01/2012 - 19:24
Hi, Alex.
I still trying to understand how to create IGES files. When I used the following command: "IGESControl_Writer Writer;" to create my writer, got this error:
command to compile: g++ -I/usr/include/opencascade/ -o helloMod hello.cpp -lTKGeomBase -lTKernel
Error:
/tmp/ccTIbohm.o: In function `main':
hello.cpp:(.text+0x1a9): undefined reference to `IGESControl_Writer::IGESControl_Writer()'
collect2: ld returned 1 exit status
I send my file (with the main routine) attached, but there´s the program below:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
cout << "Tutorial OpenCascade - My first application" << endl;
// Some initial data
int myHeight = 70;
int myWidth = 50;
int myThickness = 30;
// My 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);
// Object to be written
GC_MakeSegment mkSeg (aPnt1 , aPnt2);
// My writer
IGESControl_Writer Writer; // Error happens here
return 0;
}
Fri, 06/01/2012 - 19:36
Hi, Alex. I solved my problems (at least, for a while).
I added the following to the compile command: "-lTKIGES"
the complete command is the following: "g++ -I/usr/include/opencascade/ -o helloMod hello.cpp -lTKGeomBase -lTKernel -lTKIGES"
Thank you (and everybody) for the help!