我在C ++程序中使用CamBoard Nano和Point Cloud Library。它现在使用了几个其他库和一个主要的C ++函数。其他人为Windows编写了代码,我将其移植到Linux(Ubuntu 12.04)。我已经能够使用Makefile编译C ++文件,但现在我从目标文件中得到了大量的错误。我是C ++的新手,我不明白他们的意思。看起来它们都来自同一个问题,希望一个改变将解决所有问题。
我能够通过安装一些库(PCL,VTK,Eigen,OpenNI等)来解决C ++文件中的错误。我会在下面发布我可以解决的错误,它们比整个终端更多。我确实环顾了谷歌,我发现了这个:Qt 4.7 + VTK 5.6.1 on Mac OS X 10.6: errors linking projects
我下载了QT 5.3,但是当我在示例程序中使用cmake时,我收到以下错误:
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:20 (message):
VTK was not built with Qt
-- Configuring incomplete, errors occurred!
我现在试图解决这个问题。我将在下面发布我的Makefile和错误,所以如果有人知道如何解决这个问题或有建议,请告诉我。谢谢!
生成文件:
CC = g++-4.4
CFLAGS = -I ../include -I ~/../../usr/include/pcl-1.7/ -I ~/../../usr/include/eigen3/Eigen/src -I ~/../../usr/include/vtk-5.8
# first location: pmd header files (include, back one directory)
# second location: your pcl header files
# third location: your eigen header files
# fourth location: your vtk header files
LDFLAGS = -L. -lpmdaccess2 -lc
all: main
main: main.cpp copysdk copyplugins
$(CC) $(CFLAGS) -c -o main.o main.cpp
$(CC) $(LDFLAGS) -o main main.o
copysdk:
cp ../bin/libpmdaccess* ./ # bin folder back one directory
copyplugins:
cp ../bin/camboardnano* ./
clean:
rm main
rm main.o
rm camboardnano*
rm libpmdaccess*
错误示例:
main.o: In function `bool pcl::visualization::PCLVisualizer::addArrow<pcl::PointXYZ, pcl::PointXYZ>(pcl::PointXYZ const&, pcl::PointXYZ const&, double, double, double, double, double, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
main.cpp:(.text._ZN3pcl13visualization13PCLVisualizer8addArrowINS_8PointXYZES3_EEbRKT_RKT0_ddddddRKSsi[bool pcl::visualization::PCLVisualizer::addArrow<pcl::PointXYZ, pcl::PointXYZ>(pcl::PointXYZ const&, pcl::PointXYZ const&, double, double, double, double, double, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)]+0xcc): undefined reference to `pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)'
main.cpp:(.text._ZN3pcl13visualization13PCLVisualizer8addArrowINS_8PointXYZES3_EEbRKT_RKT0_ddddddRKSsi[bool pcl::visualization::PCLVisualizer::addArrow<pcl::PointXYZ, pcl::PointXYZ>(pcl::PointXYZ const&, pcl::PointXYZ const&, double, double, double, double, double, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)]+0x22d): undefined reference to `vtkActor2D::GetProperty()'
main.cpp:(.text._ZN3pcl13visualization13PCLVisualizer8addArrowINS_8PointXYZES3_EEbRKT_RKT0_ddddddRKSsi[bool pcl::visualization::PCLVisualizer::addArrow<pcl::PointXYZ, pcl::PointXYZ>(pcl::PointXYZ const&, pcl::PointXYZ const&, double, double, double, double, double, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)]+0x279): undefined reference to `pcl::visualization::PCLVisualizer::addActorToRenderer(vtkSmartPointer<vtkProp> const&, int)'
main.o: In function `bool pcl::visualization::PCLVisualizer::addPointCloud<pcl::PointXYZ>(pcl::PointCloud<pcl::PointXYZ>::ConstPtr const&, pcl::visualization::PointCloudGeometryHandler<pcl::PointXYZ> const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
main.cpp:(.text._ZN3pcl13visualization13PCLVisualizer13addPointCloudINS_8PointXYZEEEbRKNS_10PointCloudIT_E8ConstPtrERKNS0_25PointCloudGeometryHandlerIS5_EERKSsi[bool pcl::visualization::PCLVisualizer::addPointCloud<pcl::PointXYZ>(pcl::PointCloud<pcl::PointXYZ>::ConstPtr const&, pcl::visualization::PointCloudGeometryHandler<pcl::PointXYZ> const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)]+0x84): undefined reference to `pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)'
main.o: In function `vtkSmartPointer<vtkDataSet>::~vtkSmartPointer()':
这些并非所有错误,但可以在此处找到适合终端的所有错误:
我注意到的一件事是vtkSmartPointer出现了很多。我认为这是第一个头文件,当我尝试编译没有VTK库的C ++代码时,我收到了通知。不知道这是否意味着什么。