VTK继承问题
VTK inheritance Issue
我目前正在尝试自定义 c++ android 本机示例,以便能够更改在使用平板电脑时与 2(或 3)根手指交互时发生的行为。因此,根据我对 VTK 管道的理解,我应该修改 vtkAndroidRenderWindowInteractor 的行为(如果我错了,请纠正我)。
所以这就是我到目前为止所拥有的:
myRenderInteractor.h
#include "vtkAndroidRenderWindowInteractor.h"
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkRenderWindowInteractor.h"
#ifndef LOGI
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "NativeVTK", __VA_ARGS__))
#endif
#ifndef LOGW
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "NativeVTK", __VA_ARGS__))
#endif
class myRenderInteractor : public vtkAndroidRenderWindowInteractor {
public:
static myRenderInteractor *New();
vtkTypeMacro(myRenderInteractor, vtkAndroidRenderWindowInteractor);
void PrintSelf(ostream& os, vtkIndent indent);
void log();
protected:
myRenderInteractor();
~myRenderInteractor();
};
myRenderInteractor.cxx
#include "myRenderInteractor.h"
vtkStandardNewMacro(myRenderInteractor);
myRenderInteractor::myRenderInteractor(){
vtkAndroidRenderWindowInteractor();
}
~myRenderInteractor::myRenderInteractor(){
~vtkAndroidRenderWindowInteractor();
}
void myRenderInteractor::log(){
// ...
}
最后在 main.cxx
#include "vtkNew.h"
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkConeSource.h"
#include "vtkDebugLeaks.h"
#include "vtkGlyph3D.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkSphereSource.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
#include "myRenderInteractor.h"
#include "vtkAndroidRenderWindowInteractor.h"
#include <android/log.h>
#include <android_native_app_glue.h>
#ifndef LOGI
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "NativeVTK", __VA_ARGS__))
#endif
#ifndef LOGW
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "NativeVTK", __VA_ARGS__))
#endif
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main(struct android_app* state)
{
// Make sure glue isn't stripped.
app_dummy();
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderer> renderer;
vtkNew<myRenderInteractor> iren;
// this line is key, it provides the android
// state to VTK
iren->SetAndroidApplication(state);
renWin->AddRenderer(renderer.Get());
iren->SetRenderWindow(renWin.Get());
vtkNew<vtkSphereSource> sphere;
sphere->SetThetaResolution(8);
sphere->SetPhiResolution(8);
vtkNew<vtkPolyDataMapper> sphereMapper;
sphereMapper->SetInputConnection(sphere->GetOutputPort());
vtkNew<vtkActor> sphereActor;
sphereActor->SetMapper(sphereMapper.Get());
vtkNew<vtkConeSource> cone;
cone->SetResolution(6);
vtkNew<vtkGlyph3D> glyph;
glyph->SetInputConnection(sphere->GetOutputPort());
glyph->SetSourceConnection(cone->GetOutputPort());
glyph->SetVectorModeToUseNormal();
glyph->SetScaleModeToScaleByVector();
glyph->SetScaleFactor(0.25);
vtkNew<vtkPolyDataMapper> spikeMapper;
spikeMapper->SetInputConnection(glyph->GetOutputPort());
vtkNew<vtkActor> spikeActor;
spikeActor->SetMapper(spikeMapper.Get());
renderer->AddActor(sphereActor.Get());
renderer->AddActor(spikeActor.Get());
renderer->SetBackground(0.4,0.5,0.6);
vtkNew<vtkTextActor> ta;
ta->SetInput("Droids Rock");
ta->GetTextProperty()->SetColor( 0.5, 1.0, 0.0 );
ta->SetDisplayPosition(50,50);
ta->GetTextProperty()->SetFontSize(32);
renderer->AddActor(ta.Get());
renWin->Render();
iren->Start();
}
我面临的问题是出现以下错误。所以也许我只是愚蠢地忘记了一些非常简单的东西,但我就是找不到为什么我会得到它。
/Users/.../Desktop/VTKNew/Common/Core/vtkNew.h:66: error:
undefined reference to 'myRenderInteractor::New()' collect2: error: ld
returned 1 exit status make[3]: ***
[Examples/Android/NativeVTK/libs/armeabi-v7a/libNativeVTK.so] Error 1
make[2]: ***
[Examples/Android/NativeVTK/jni/CMakeFiles/NativeVTK.dir/all] Error 2
make[1]: ***
[Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule]
Error 2 make: ***
[Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule]
Error 2
很想就此获得一些帮助。
提前致谢
编辑: 在我的 Makefile 中 Examples/Android/NativeVTK/ 我有:
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule:
cd /Users/lonnibesancon/Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
# Convenience name for target.
NativeVTK-ant-configure: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
.PHONY : NativeVTK-ant-configure
# fast build rule for target.
NativeVTK-ant-configure/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/build
.PHONY : NativeVTK-ant-configure/fast
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
# Convenience name for target.
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
.PHONY : NativeVTK-apk-debug
# fast build rule for target.
NativeVTK-apk-debug/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build
.PHONY : NativeVTK-apk-debug/fast
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
# Convenience name for target.
NativeVTK-apk-release: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
.PHONY : NativeVTK-apk-release
# fast build rule for target.
NativeVTK-apk-release/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/build
.PHONY : NativeVTK-apk-release/fast
所以我认为我应该检查 build.make 其中包含:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.1
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.1.2/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.1.2/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/.../Desktop/VTKNew
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android
# Utility rule file for NativeVTK-apk-debug.
# Include the progress variables for this target.
include Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/progress.make
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK && /usr/local/bin/ant -file /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK/build.xml debug
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build.make
.PHONY : NativeVTK-apk-debug
# Rule to build all files generated by this target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build: NativeVTK-apk-debug
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/clean:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK && $(CMAKE_COMMAND) -P CMakeFiles/NativeVTK-apk-debug.dir/cmake_clean.cmake
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/clean
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/depend:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/.../Desktop/VTKNew /Users/.../Desktop/VTKNew/Examples/Android/NativeVTK /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/.../Android/NativeVTK /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/.../Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/depend
这是我需要更改的文件吗?坦率地说,我完全迷路了,并且很想获得更多关于整个过程的文档,因为由于某种原因我无法使用 cmake。当然,我宁愿不必直接修改 makefile,但现在看来我别无选择。
这看起来像是您在库中定义了 myRenderInteractor,但后来忘记通过 target_link_libraries.
将您的可执行文件 link 到该库
根据您问题中的错误输出,您从 ld 收到 "undefined reference" 错误——这是一个 linker 错误。您的代码编译得很好。您需要将包含 myRenderInteractor 的库添加到库列表 linked 到您的最终可执行文件中。如果您不使用 CMake 生成涉及的 makefile,那么您需要将库名称添加到您手工制作的 make 文件中 linked 的列表中。
我目前正在尝试自定义 c++ android 本机示例,以便能够更改在使用平板电脑时与 2(或 3)根手指交互时发生的行为。因此,根据我对 VTK 管道的理解,我应该修改 vtkAndroidRenderWindowInteractor 的行为(如果我错了,请纠正我)。 所以这就是我到目前为止所拥有的:
myRenderInteractor.h
#include "vtkAndroidRenderWindowInteractor.h"
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkRenderWindowInteractor.h"
#ifndef LOGI
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "NativeVTK", __VA_ARGS__))
#endif
#ifndef LOGW
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "NativeVTK", __VA_ARGS__))
#endif
class myRenderInteractor : public vtkAndroidRenderWindowInteractor {
public:
static myRenderInteractor *New();
vtkTypeMacro(myRenderInteractor, vtkAndroidRenderWindowInteractor);
void PrintSelf(ostream& os, vtkIndent indent);
void log();
protected:
myRenderInteractor();
~myRenderInteractor();
};
myRenderInteractor.cxx
#include "myRenderInteractor.h"
vtkStandardNewMacro(myRenderInteractor);
myRenderInteractor::myRenderInteractor(){
vtkAndroidRenderWindowInteractor();
}
~myRenderInteractor::myRenderInteractor(){
~vtkAndroidRenderWindowInteractor();
}
void myRenderInteractor::log(){
// ...
}
最后在 main.cxx
#include "vtkNew.h"
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkConeSource.h"
#include "vtkDebugLeaks.h"
#include "vtkGlyph3D.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkSphereSource.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
#include "myRenderInteractor.h"
#include "vtkAndroidRenderWindowInteractor.h"
#include <android/log.h>
#include <android_native_app_glue.h>
#ifndef LOGI
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "NativeVTK", __VA_ARGS__))
#endif
#ifndef LOGW
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "NativeVTK", __VA_ARGS__))
#endif
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main(struct android_app* state)
{
// Make sure glue isn't stripped.
app_dummy();
vtkNew<vtkRenderWindow> renWin;
vtkNew<vtkRenderer> renderer;
vtkNew<myRenderInteractor> iren;
// this line is key, it provides the android
// state to VTK
iren->SetAndroidApplication(state);
renWin->AddRenderer(renderer.Get());
iren->SetRenderWindow(renWin.Get());
vtkNew<vtkSphereSource> sphere;
sphere->SetThetaResolution(8);
sphere->SetPhiResolution(8);
vtkNew<vtkPolyDataMapper> sphereMapper;
sphereMapper->SetInputConnection(sphere->GetOutputPort());
vtkNew<vtkActor> sphereActor;
sphereActor->SetMapper(sphereMapper.Get());
vtkNew<vtkConeSource> cone;
cone->SetResolution(6);
vtkNew<vtkGlyph3D> glyph;
glyph->SetInputConnection(sphere->GetOutputPort());
glyph->SetSourceConnection(cone->GetOutputPort());
glyph->SetVectorModeToUseNormal();
glyph->SetScaleModeToScaleByVector();
glyph->SetScaleFactor(0.25);
vtkNew<vtkPolyDataMapper> spikeMapper;
spikeMapper->SetInputConnection(glyph->GetOutputPort());
vtkNew<vtkActor> spikeActor;
spikeActor->SetMapper(spikeMapper.Get());
renderer->AddActor(sphereActor.Get());
renderer->AddActor(spikeActor.Get());
renderer->SetBackground(0.4,0.5,0.6);
vtkNew<vtkTextActor> ta;
ta->SetInput("Droids Rock");
ta->GetTextProperty()->SetColor( 0.5, 1.0, 0.0 );
ta->SetDisplayPosition(50,50);
ta->GetTextProperty()->SetFontSize(32);
renderer->AddActor(ta.Get());
renWin->Render();
iren->Start();
}
我面临的问题是出现以下错误。所以也许我只是愚蠢地忘记了一些非常简单的东西,但我就是找不到为什么我会得到它。
/Users/.../Desktop/VTKNew/Common/Core/vtkNew.h:66: error: undefined reference to 'myRenderInteractor::New()' collect2: error: ld returned 1 exit status make[3]: ***
[Examples/Android/NativeVTK/libs/armeabi-v7a/libNativeVTK.so] Error 1 make[2]: ***
[Examples/Android/NativeVTK/jni/CMakeFiles/NativeVTK.dir/all] Error 2 make[1]: ***
[Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule] Error 2 make: ***
[Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule] Error 2
很想就此获得一些帮助。
提前致谢
编辑: 在我的 Makefile 中 Examples/Android/NativeVTK/ 我有:
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule:
cd /Users/lonnibesancon/Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
# Convenience name for target.
NativeVTK-ant-configure: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/rule
.PHONY : NativeVTK-ant-configure
# fast build rule for target.
NativeVTK-ant-configure/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-ant-configure.dir/build
.PHONY : NativeVTK-ant-configure/fast
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
# Convenience name for target.
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/rule
.PHONY : NativeVTK-apk-debug
# fast build rule for target.
NativeVTK-apk-debug/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build
.PHONY : NativeVTK-apk-debug/fast
# Convenience name for target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f CMakeFiles/Makefile2 Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
# Convenience name for target.
NativeVTK-apk-release: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/rule
.PHONY : NativeVTK-apk-release
# fast build rule for target.
NativeVTK-apk-release/fast:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(MAKE) -f Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/build.make Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-release.dir/build
.PHONY : NativeVTK-apk-release/fast
所以我认为我应该检查 build.make 其中包含:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.1
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.1.2/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.1.2/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/.../Desktop/VTKNew
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android
# Utility rule file for NativeVTK-apk-debug.
# Include the progress variables for this target.
include Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/progress.make
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK && /usr/local/bin/ant -file /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK/build.xml debug
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug
NativeVTK-apk-debug: Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build.make
.PHONY : NativeVTK-apk-debug
# Rule to build all files generated by this target.
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build: NativeVTK-apk-debug
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/build
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/clean:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/Examples/Android/NativeVTK && $(CMAKE_COMMAND) -P CMakeFiles/NativeVTK-apk-debug.dir/cmake_clean.cmake
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/clean
Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/depend:
cd /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/.../Desktop/VTKNew /Users/.../Desktop/VTKNew/Examples/Android/NativeVTK /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/.../Android/NativeVTK /Users/.../Desktop/VTKNew/vtkbin/CMakeExternals/Build/vtk-android/.../Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : Examples/Android/NativeVTK/CMakeFiles/NativeVTK-apk-debug.dir/depend
这是我需要更改的文件吗?坦率地说,我完全迷路了,并且很想获得更多关于整个过程的文档,因为由于某种原因我无法使用 cmake。当然,我宁愿不必直接修改 makefile,但现在看来我别无选择。
这看起来像是您在库中定义了 myRenderInteractor,但后来忘记通过 target_link_libraries.
将您的可执行文件 link 到该库根据您问题中的错误输出,您从 ld 收到 "undefined reference" 错误——这是一个 linker 错误。您的代码编译得很好。您需要将包含 myRenderInteractor 的库添加到库列表 linked 到您的最终可执行文件中。如果您不使用 CMake 生成涉及的 makefile,那么您需要将库名称添加到您手工制作的 make 文件中 linked 的列表中。