我一直在尝试编译Salome解算器GUI以与FreeCad一起使用。基本错误是:
Scanning dependencies of target SALOME_Session_Server
[ 90%] Building CXX object src/Session/CMakeFiles/SALOME_Session_Server.dir/SALOME_Session_Server.cxx.o
[ 91%] Linking CXX executable SALOME_Session_Server
...-rpath-link /usr/local/lib -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/8/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: ../VTKViewer/libVTKViewer.so: undefined reference to `VTKViewer_OpenGLHelper::SetUniformMatrix(int, vtkMatrix4x4 const*) const'
collect2: error: ld returned 1 exit status
(我删除了大部分不相关的ld -v输出)
当GCC尝试构建和链接Salome Session Server可执行文件时,在编译结束时出现此错误。我尝试添加:
#include <VTKViewer_OpenGLHelper.h>
其中包含:
#ifdef VTK_OPENGL2
void SetUniformMatrix (const GLint theLocation,
const vtkMatrix4x4* theMatrix) const;
#endif
至:
SALOME_Session_Server.cxx
并更新CMakeLists.txt文件。
VTKViewer模块可以在构建的早期阶段进行编译和链接而不会出现错误。 (创建VTKViewer.so)
谷歌搜索此错误,我知道 somewhere 中缺少定义,我只是不知道在哪里。我试过在Salome Session .cxx模块的所有四个文件中都包含VTKViewer_OpenGLHelper.h标头。我不是C ++程序员,所以我对链接器的要求和时间感到困惑。
ld -v给了我很大一部分库,这些库将Salome_Session_Server可执行文件链接到了该库,显然VTKViewer.so就是发生错误的地方。
任何建议将不胜感激。