link error at lesson 11.

karim

Member
hello,
I am going through the lesson 11. It worked for me until adding features. I am on debian 10. qtcreator, g++ compiler.
here is the error:



build-OcafTest-Desktop-Debug/OcafTest: symbol lookup error: /home/karim/build-OcafTest-Desktop-Debug/OcafTest: undefined symbol: _ZNK18TNaming_NamedShape8DumpJsonERSoi

My last successful build has all the Ocaf lib linked. I dont know what is going on.
>> ldd OcafTest |grep CAF
libTKXCAF.so.7 => /usr/local/lib/libTKXCAF.so.7 (0x00007f1573935000)
libTKCAF.so.7 => /usr/local/lib/libTKCAF.so.7 (0x00007f1573895000)
libTKLCAF.so.7 => /usr/local/lib/libTKLCAF.so.7 (0x00007f15737a2000)
libTKDCAF.so.7 => /usr/local/lib/libTKDCAF.so.7 (0x00007f15736a8000)
libTKBinXCAF.so.7 => /usr/local/lib/libTKBinXCAF.so.7 (0x00007f157367e000)
libTKVCAF.so.7 => /usr/local/lib/libTKVCAF.so.7 (0x00007f1571560000)
 

karim

Member
There is another problem, building lesson 10. I dont know if it will replicate with your builds but the doc.cbf is empty after execution. the browser from draw program does not show any thing.
 

Quaoar

Administrator
Staff member
When I compile lesson 11 on Ubuntu 20, I get compilation errors in the first place:

1627904609104.png
This is fixed by adding the missing include statement for TDocStd_Document. I think that's something mentioned by @markov D in this thread.

Then I adjusted a bit the CMakeLists.txt for the lesson 11 to make it work for linux. Now it compiles at least. You may want to have a look at the recent commit in the repo.
 

karim

Member
My output file is empty because there is a runtime link error (I guess)


/build-OcafTest-Desktop-Debug/OcafTest: symbol lookup error: /home/karim/build-OcafTest-Desktop-Debug/OcafTest: undefined symbol: _ZN19TDocStd_Application6SaveAsERKN11opencascade6handleI16TDocStd_DocumentEERK26TCollection_ExtendedStringRK21Message_ProgressRange


I have included these files:

#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
#include <TDataStd_Integer.hxx>
#include <BinDrivers.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Message_ProgressRange.hxx>


and my linker links against:

LIBS += \
-lTKernel \
-lTKMath \
-lTKG3d \
-lTKBRep \
-lTKGeomBase\
-lTKGeomAlgo\
-lTKTopAlgo \
-lTKPrim \
-lTKBO \
-lTKBool \
-lTKOffset \
-lTKService \
-lTKV3d \
-lTKOpenGl \
-lTKXCAF \
-lTKDCAF \
-lTKLCAF \
-lTKDCAF \
-lTKBinXCAF \
-lTKBin \
-lTKFillet


Why the link error, I don't know.

When I run the exectable from the qtcreator IDE, it provides the link error message, when I run from console, ti does not give any error message. Strange.
 
Last edited:

Quaoar

Administrator
Staff member
My output file is empty because there is a runtime link error (I guess)


/build-OcafTest-Desktop-Debug/OcafTest: symbol lookup error: /home/karim/build-OcafTest-Desktop-Debug/OcafTest: undefined symbol: _ZN19TDocStd_Application6SaveAsERKN11opencascade6handleI16TDocStd_DocumentEERK26TCollection_ExtendedStringRK21Message_ProgressRange


I have included these files:

#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
#include <TDataStd_Integer.hxx>
#include <BinDrivers.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Message_ProgressRange.hxx>


and my linker links against:

LIBS += \
-lTKernel \
-lTKMath \
-lTKG3d \
-lTKBRep \
-lTKGeomBase\
-lTKGeomAlgo\
-lTKTopAlgo \
-lTKPrim \
-lTKBO \
-lTKBool \
-lTKOffset \
-lTKService \
-lTKV3d \
-lTKOpenGl \
-lTKXCAF \
-lTKDCAF \
-lTKLCAF \
-lTKDCAF \
-lTKBinXCAF \
-lTKBin \
-lTKFillet


Why the link error, I don't know.
I used cmake to prepare makefiles. What if you generate them with cmake and then compare?
 

karim

Member
I compile and link lesson 11 from your repository. it produces a file which is attached. It is also empty when browsing with draw.
 

Attachments

  • test.cbf.zip
    1.1 KB · Views: 0

Quaoar

Administrator
Staff member
@karim I'll check how it runs on my linux machine once I reach it (today in the evening or tomorrow).
 

karim

Member
Ok. Thanks, I think it is probably due to faults in my settings, machine, or linux installation. Maybe my draw installation is faulty. I dont know.
 

karim

Member
It is definitely a saveas error or a draw harness error. I can iterate over the labels and print them. The labels are there.
 
Top