build the project lesson12_xde failed

markov D

CAD practitioner
error: C2440 .this error shows me :“T *” can not Converted“ to “Standard_Transient *” Lesson_12_XDE D:\OCC\opencascade-install\inc\Standard_Handle.hxx 62
 

Quaoar

Administrator
Staff member
error: C2440 .this error shows me :“T *” can not Converted“ to “Standard_Transient *” Lesson_12_XDE D:\OCC\opencascade-install\inc\Standard_Handle.hxx 62
Strange. I just checked it again in Visual Studio 2019 x64 and it compiled smoothly. Would you mind posting the full compilation log from the "Output" window of IDE?
 

markov D

CAD practitioner
sure.
Build started...
1>------ Build started: Project: Lesson_12_XDE, Configuration: Debug x64 ------
1>main.cpp
1>D:\OCC\opencascade-install\inc\Standard_Handle.hxx(62,33): error C2440: 'initializing': cannot convert from 'T *' to 'Standard_Transient *'
1> with
1> [
1> T=TDocStd_Document
1> ]
1>D:\OCC\opencascade-install\inc\Standard_Handle.hxx(62,33): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>D:\OCC\opencascade-install\inc\Standard_Handle.hxx(62): message : while compiling class template member function 'opencascade::handle<TDocStd_Document>::handle(T *)'
1> with
1> [
1> T=TDocStd_Document
1> ]
1>D:\OCC\demo\Lesson12_XDE\Lesson12_XDE\main.cpp(33): message : see reference to function template instantiation 'opencascade::handle<TDocStd_Document>::handle(T *)' being compiled
1> with
1> [
1> T=TDocStd_Document
1> ]
1>D:\OCC\demo\Lesson12_XDE\Lesson12_XDE\DisplayScene.h(97): message : see reference to class template instantiation 'opencascade::handle<TDocStd_Document>' being compiled
1>D:\OCC\opencascade-install\inc\Standard_Handle.hxx(63,1): error C2439: 'opencascade::handle<TDocStd_Document>::entity': member could not be initialized
1>D:\OCC\opencascade-install\inc\Standard_Handle.hxx(401): message : see declaration of 'opencascade::handle<TDocStd_Document>::entity'
1>ViewerInteractor.cpp
1>Generating Code...
1>Done building project "Lesson_12_XDE.vcxproj" -- FAILED.
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========
 

Quaoar

Administrator
Staff member
That looks like a missing header issue. Might be specific to some version of Visual Studio. Try including all suspicious types, e.g. TDocStd_Document.
 
Top