如何使用Makefile使用VTK库编译项目? [英] How to compile project using VTK library using Makefile?
问题描述
出于这个原因,我下载了C ++库VTK并制作了OSX环境上build
子目录中的本地版本.
For this reason I downloaded the C++ library VTK and made a local build in the build
subdirectory on a OSX environment.
我想使用该库(尤其是我使用类vtkSmartPointer
)和Makefile
来编译项目.
I would like to compile a project using this library (particularly I am using the class vtkSmartPointer
) with Makefile
.
例如考虑以下源代码:
#include<iostream>
#include<vtkSmartPointer.h>
#include<vtkCallbackCommand.h>
int main()
{
vtkSmartPointer<vtkCallbackCommand> keypressCallback =
vtkSmartPointer<vtkCallbackCommand>::New();
std::cout<<"hello world\n";
return 0;
}
对于 我的环境变量 当我尝试编译正在运行的 When I try to compile running Makefile或程序中的哪个部分或过程中的哪个步骤不正确? What part of the Makefile or program or step in the process is not correct? 谢谢. 当前VTK库不包含 The current VTK library does not contain 这篇关于如何使用Makefile使用VTK库编译项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!Makefile
,我从
DYLD_LIBRARY_PATH
的值为../cmake_bin_dir/instDir/lib:../VTK/build/lib/
.make
时,出现以下错误:make
, I get the following error: ld: library not found for -lvtkCommon
clang: error: linker command failed with exit code 1 (use -v to see invocation)
推荐答案
libVtkCommon.so
(请参阅软件包内容部分libVtkCommon.so
(see package contents section https://www.archlinux.org/packages/community/x86_64/vtk/). Are you looking for libVtkCommonCore.so
? If that is the case you have to change -lvtkCommon
to -lvtkCommonCore
in your Makefile. The same seems to be the case for some of the other included libraries.