Cannot compile simple linux application

I am trying to compile the following code

#include
#include
#include
#include
#include
#include

using namespace std;

int main()
{
cout

//Read sample step file
string file = "../linkrods.step";
STEPControl_Reader reader = STEPControl_Reader();
IFSelect_ReturnStatus stat = reader.ReadFile(file.c_str());
reader.NbRootsForTransfer();
reader.TransferRoots();
return 0;
}

But I get the following errors

In file included from /home/aris/Downloads/occTest/main.cpp:3:0:
/home/aris/Downloads/occ/occ-build-autotools/inc/TColStd_SequenceOfTransient.hxx: In copy constructor ‘XSControl_Reader::XSControl_Reader(const XSControl_Reader&)’:
/home/aris/Downloads/occ/occ-build-autotools/inc/TColStd_SequenceOfTransient.hxx:111:21: error: ‘TColStd_SequenceOfTransient::TColStd_SequenceOfTransient(const TColStd_SequenceOfTransient&)’ is private
Standard_EXPORT TColStd_SequenceOfTransient(const TColStd_SequenceOfTransient& Other);
^
In file included from /home/aris/Downloads/occ/occ-build-autotools/inc/STEPControl_Reader.hxx:20:0,
from /home/aris/Downloads/occTest/main.cpp:4:
/home/aris/Downloads/occ/occ-build-autotools/inc/XSControl_Reader.hxx:92:7: error: within this context
class XSControl_Reader {
^
In file included from /home/aris/Downloads/occ/occ-build-autotools/inc/XSControl_Reader.hxx:29:0,
from /home/aris/Downloads/occ/occ-build-autotools/inc/STEPControl_Reader.hxx:20,
from /home/aris/Downloads/occTest/main.cpp:4:
/home/aris/Downloads/occ/occ-build-autotools/inc/TopTools_SequenceOfShape.hxx:108:21: error: ‘TopTools_SequenceOfShape::TopTools_SequenceOfShape(const TopTools_SequenceOfShape&)’ is private
Standard_EXPORT TopTools_SequenceOfShape(const TopTools_SequenceOfShape& Other);
^
In file included from /home/aris/Downloads/occ/occ-build-autotools/inc/STEPControl_Reader.hxx:20:0,
from /home/aris/Downloads/occTest/main.cpp:4:
/home/aris/Downloads/occ/occ-build-autotools/inc/XSControl_Reader.hxx:92:7: error: within this context
class XSControl_Reader {
^
In file included from /home/aris/Downloads/occTest/main.cpp:4:0:
/home/aris/Downloads/occ/occ-build-autotools/inc/STEPControl_Reader.hxx: In copy constructor ‘STEPControl_Reader::STEPControl_Reader(const STEPControl_Reader&)’:
/home/aris/Downloads/occ/occ-build-autotools/inc/STEPControl_Reader.hxx:80:7: note: synthesized method ‘XSControl_Reader::XSControl_Reader(const XSControl_Reader&)’ first required here
class STEPControl_Reader : public XSControl_Reader {
^
/home/aris/Downloads/occTest/main.cpp: In function ‘int main()’:
/home/aris/Downloads/occTest/main.cpp:17:52: note: synthesized method ‘STEPControl_Reader::STEPControl_Reader(const STEPControl_Reader&)’ first required here
STEPControl_Reader reader = STEPControl_Reader();
^
make[2]: *** [CMakeFiles/Hello.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Hello.dir/all] Error 2
make: *** [all] Error 2

And I have no idea why..

Shu Huang's picture

Dear all,
I have the same problem compiling OCCT under Linux. Does anyone know how to deal with this problem? Many thanks...

Forum supervisor's picture

Dear Shu Phang,

Check, please all libraries on undefined symbols first.
See example below.

export list=`ls *.so`
for f in $list; do
echo $f
ldd -r $f | grep undefined
done

If it will not help, specify, please the next additional information.
We will try to check it.
1. Linux version
2. gcc version
3. Do you use 'tbb' ?
Best regards
FSR

Shu Huang's picture

Thank you.

Looks like it's the problem of __declspec(dllexport) in Standard_Macro.hxx under Linux??

Strange, isn't OCCT Windows and Linux cross-platformed?

BTW, gcc-4.9.1
Linxu-3.10.56
I don't know how to check whether using tbb or not?

Thank you again in advance.

Forum supervisor's picture

Dear Shu Huang,
Could you describe more precisely the configuration you are using:
- platform (which Linus? Ubuntu, Suse or any other...)
- version of Open CasCade (6.7.0, 6.7.1 or any other)
- used bit mode (32 | 64)
Best regards
Sergey