matlab引擎+ pcl构建链接器错误

时间:2015-11-20 05:28:51

标签: c++ matlab linker cmake point-cloud-library

代码:

#include <pcl/io/pcd_io.h>
#include <pcl/filters/passthrough.h>

int
main(int argc, char** argv)
{
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointCloud<pcl::PointXYZ>::Ptr filteredCloud(new pcl::PointCloud<pcl::PointXYZ>);

    if (pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0)
    {
        return -1;
    }

    pcl::PassThrough<pcl::PointXYZ> filter;
    filter.setInputCloud(cloud);
    filter.setFilterFieldName("z");
    filter.setFilterLimits(0.0, 2.0);

    filter.filter(*filteredCloud);
}

Cmakelists1.txt :(支持连接到matlab引擎) Cmakelists2.txt :(不支持)

当我使用Cmakelists2.txt构建代码时,我没有错误 但是当我使用Cmakelists1.txt构建代码时,我得到了一个巨大的未定义引用错误列表。 Cmakelists1.txt是Cmakelists2.txt的超集,所以无论2的构建都应该用1构建

代码是极简主义代码&amp;为清楚起见,我删除了matlab部分。 有人可以帮忙吗?

Cmakelists1.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(passthrough_test)
find_package(PCL 1.2 REQUIRED)
set (PROJECT_LINK_LIBS libeng.so libmat.so libmx.so libut.so)
link_directories(${PCL_LIBRARY_DIRS} /usr/local/MATLAB/R2014a/bin/glnxa64)
include_directories(${PCL_INCLUDE_DIRS} /usr/local/MATLAB/R2014a/extern/include/)
add_definitions(${PCL_DEFINITIONS})
add_executable (passthrough_test passthrough_test.cpp)
target_link_libraries (passthrough_test ${PCL_LIBRARIES} ${PROJECT_LINK_LIBS})

Cmakelists2.txt:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(passthrough_test)
find_package(PCL 1.2 REQUIRED)
link_directories(${PCL_LIBRARY_DIRS})
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (passthrough_test passthrough_test.cpp)
target_link_libraries (passthrough_test ${PCL_LIBRARIES})

错误列表:

Linking CXX executable passthrough_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/passthrough_test.dir/link.txt --verbose=1
/usr/bin/c++     -Wno-deprecated -g     CMakeFiles/passthrough_test.dir/passthrough_test.cpp.o  -o passthrough_test  -L/usr/local/lib  -L/usr/local/MATLAB/R2014a/bin/glnxa64 -rdynamic -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lpthread /usr/local/lib/libpcl_common.so -Wl,-Bstatic -lflann_cpp_s -Wl,-Bdynamic /usr/local/lib/libpcl_kdtree.so /usr/local/lib/libpcl_octree.so /usr/local/lib/libpcl_search.so /usr/local/lib/libpcl_sample_consensus.so /usr/local/lib/libpcl_filters.so -lOpenNI -lOpenNI2 /usr/lib/libvtkCommon.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkGenericFiltering.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkGeovis.so.5.8.0 /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkCharts.so.5.8.0 /usr/local/lib/libpcl_io.so /usr/local/lib/libpcl_features.so /usr/local/lib/libpcl_ml.so /usr/local/lib/libpcl_segmentation.so /usr/local/lib/libpcl_visualization.so /usr/local/lib/libpcl_outofcore.so /usr/local/lib/libpcl_cuda_features.so /usr/local/lib/libpcl_cuda_segmentation.so /usr/local/lib/libpcl_cuda_io.so /usr/local/lib/libpcl_cuda_sample_consensus.so -lqhull /usr/local/lib/libpcl_surface.so /usr/local/lib/libpcl_registration.so /usr/local/lib/libpcl_recognition.so /usr/local/lib/libpcl_keypoints.so /usr/local/lib/libpcl_gpu_containers.so /usr/local/lib/libpcl_gpu_utils.so /usr/local/lib/libpcl_gpu_octree.so /usr/local/lib/libpcl_gpu_features.so /usr/local/lib/libpcl_gpu_segmentation.so /usr/local/lib/libpcl_gpu_surface.so /usr/local/lib/libpcl_gpu_kinfu.so /usr/local/lib/libpcl_gpu_kinfu_large_scale.so /usr/local/lib/libpcl_tracking.so /usr/local/lib/libpcl_stereo.so /usr/local/lib/libpcl_people.so /usr/local/lib/libpcl_apps.so /usr/local/lib/libpcl_3d_rec_framework.so -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams -lboost_serialization -lboost_chrono -lpthread -lqhull -lOpenNI -lOpenNI2 -Wl,-Bstatic -lflann_cpp_s -Wl,-Bdynamic /usr/lib/libvtkCommon.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkGenericFiltering.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkGeovis.so.5.8.0 /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkCharts.so.5.8.0 -leng -lmat -lmx -lut /usr/local/lib/libpcl_common.so /usr/local/lib/libpcl_kdtree.so /usr/local/lib/libpcl_octree.so /usr/local/lib/libpcl_search.so /usr/local/lib/libpcl_sample_consensus.so /usr/local/lib/libpcl_filters.so /usr/local/lib/libpcl_io.so /usr/local/lib/libpcl_features.so /usr/local/lib/libpcl_ml.so /usr/local/lib/libpcl_segmentation.so /usr/local/lib/libpcl_visualization.so /usr/local/lib/libpcl_outofcore.so /usr/local/lib/libpcl_cuda_features.so /usr/local/lib/libpcl_cuda_segmentation.so /usr/local/lib/libpcl_cuda_io.so /usr/local/lib/libpcl_cuda_sample_consensus.so /usr/local/lib/libpcl_surface.so /usr/local/lib/libpcl_registration.so /usr/local/lib/libpcl_recognition.so /usr/local/lib/libpcl_keypoints.so /usr/local/lib/libpcl_gpu_containers.so /usr/local/lib/libpcl_gpu_utils.so /usr/local/lib/libpcl_gpu_octree.so /usr/local/lib/libpcl_gpu_features.so /usr/local/lib/libpcl_gpu_segmentation.so /usr/local/lib/libpcl_gpu_surface.so /usr/local/lib/libpcl_gpu_kinfu.so /usr/local/lib/libpcl_gpu_kinfu_large_scale.so /usr/local/lib/libpcl_tracking.so /usr/local/lib/libpcl_stereo.so /usr/local/lib/libpcl_people.so /usr/local/lib/libpcl_apps.so /usr/local/lib/libpcl_3d_rec_framework.so -leng -lmat -lmx -lut /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0 /usr/lib/libvtkVolumeRendering.so.5.8.0 /usr/lib/libvtkHybrid.so.5.8.0 /usr/lib/libvtkParallel.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkCommon.so.5.8.0 -lm /usr/lib/libvtksys.so.5.8.0 -ldl -Wl,-rpath,/usr/local/lib:/usr/local/MATLAB/R2014a/bin/glnxa64
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
make[2]: Leaving directory `/home/shome/temp_codes/passthrough_test/build'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
make[1]: Leaving directory `/home/shome/temp_codes/passthrough_test/build'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFGetFieldDefaulted@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_write@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_free@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_free@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `_TIFFmalloc@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadTile@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `_TIFFfree@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFGetField@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFNumberOfDirectories@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_new@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFOpen@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadRGBAImage@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetField@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_connect@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_pending@OPENSSL_1.0.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFSetDirectory@LIBTIFF_4.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFReadScanline@LIBTIFF_4.0'
//usr/lib/libpq.so.5: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libvtkIO.so.5.8.0: undefined reference to `TIFFNumberOfTiles@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
make[2]: *** [passthrough_test] Error 1
make[1]: *** [CMakeFiles/passthrough_test.dir/all] Error 2
make: *** [all] Error 2

0 个答案:

没有答案