Link Error with STEPControl_Reader in importexport sample
Link Error with STEPControl_Reader in importexport sample
Yang Jianxin
2012/02/08 18:01
I try to compile the importexport sample coming with OpenCASCADE 6.5 using Visual
Studio 2010 with Qt 4.8.0, however i met following link errors:
Translate.obj : error LNK2019: unresolved external symbol "public: unsigned int
__thiscall STEPControl_Reader::TransferRoot(int)" (?TransferRoot@STEPControl_Rea
der@@QAEIH@Z) referenced in function "private: class Handle_TopTools_HSequenceOf
Shape __thiscall Translate::importSTEP(class QString const &)" (?importSTEP@Tran
slate@@AAE?AVHandle_TopTools_HSequenceOfShape@@ABVQString@@@Z)
Translate.obj : error LNK2019: unresolved external symbol "public: virtual int _
_thiscall STEPControl_Reader::NbRootsForTransfer(void)" (?NbRootsForTransfer@STE
PControl_Reader@@UAEHXZ) referenced in function "private: class Handle_TopTools_
HSequenceOfShape __thiscall Translate::importSTEP(class QString const &)" (?impo
rtSTEP@Translate@@AAE?AVHandle_TopTools_HSequenceOfShape@@ABVQString@@@Z)
......
I have checked the link libraries, "-lTKStep -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase" are in the list. I also add all OCC libraries to the list, however
the error remains. I switch the STEPControl_Reader to IGESControl_Reader, there
is no such problem. Would you please give the suggestions? Thanks.
Yang Jianxin
2012/02/14 02:17
I found the problem, it is a bug of Qt.
In the IESample.pro, it defines "-lTKStep -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase", however the
generated Makefile contains two "-lTKSTEP209.lib", i have to change one into "-lTKStep.lib", thus it works.
coustet
2012/02/14 10:37
A workaround is to use QMAKE_LFLAGS += @liblist.txt, with all the lib names in liblist.txt.
See the documentation for "LINK Command Files" in MSDN.
Benjamin Bihler
2013/03/21 14:59
Another workaround can be to specify the library including the .lib file extension for Windows systems like this:
Not so much a bug as a "feature" - when you specify a lib like -lTKStep, qmake searches for the "latest" version of that lib by checking for a numeric version suffix on the libname and uses that in the makefile. In this case that method thinks its found version "209".