如何使用Makefile使用VTK库编译项目? [英] How to compile project using VTK library using Makefile?

查看:116
本文介绍了如何使用Makefile使用VTK库编译项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于这个原因,我下载了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;
}

对于Makefile,我从

我的环境变量DYLD_LIBRARY_PATH的值为../cmake_bin_dir/instDir/lib:../VTK/build/lib/.

当我尝试编译正在运行的make时,出现以下错误:

When I try to compile running 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)

Makefile或程序中的哪个部分或过程中的哪个步骤不正确?

What part of the Makefile or program or step in the process is not correct?

谢谢.

推荐答案

当前VTK库不包含libVtkCommon.so(请参阅软件包内容部分

The current VTK library does not contain 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.

这篇关于如何使用Makefile使用VTK库编译项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆