guys! I followed the lessons by Quaoar's Workshop on Youtube, downloaded the source code of vtk (version: 9.2.6), and compiled it successfully. However, when I included the following line in my main.cpp:
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2)
VTK_MODULE_INIT(vtkIneractionStyle)
I ran into a link error. The output is:
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl vtkIneractionStyle_AutoInit_Construct(void)" (?vtkIneractionStyle_AutoInit_Construct@@YAXXZ) referenced in function "public: __cdecl `anonymous namespace'::vtkIneractionStyle_ModuleInit::vtkIneractionStyle_ModuleInit(void)" (??0vtkIneractionStyle_ModuleInit@?A0x14dbff40@@QEAA@XZ)
1>C:\Programs\HelloOCCT\x64\Debug\HelloOCCT.exe : fatal error LNK1120: 1 unresolved externals
Then I typed vtkIneractionStyle_AutoInit_Construct in Far.exe, but I can't find any related libaries in the VTK\lib directory. Note that the project is constructed from an empty project and there is only main.cpp in my project(no CMakeLists.txt). I already set Additional include Directories for C++, Additional Library Directories and Additional Dependencies for Linker and system PATH. Here is main.cpp:
#include <BRepPrimAPI_MakeBox.hxx>
#include <vtkAutoInit.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkRenderWindowInteractor.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2)
VTK_MODULE_INIT(vtkIneractionStyle)
int main()
{
BRepPrimAPI_MakeBox mkBox(1., 2., 3.);
const TopoDS_Shape& shape = mkBox.Shape();
vtkNew<vtkRenderWindow> renwin;
vtkNew<vtkRenderer> ren;
renwin->AddRenderer(ren);
vtkNew<vtkInteractorStyleTrackballCamera> istyle;
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renwin);
iren->SetInteractorStyle(istyle);
renwin->Render();
iren->Start();
return 0;
}
Is there any way to solve the problem?