Can't make the sample project build pass‏

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Can't make the sample project build pass‏

danny
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am using xcode and following the instructions on this link to create a very simple project, however I met several issues when reading this article:
http://www.pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config

1. This is the CMakelists.txt should be, however I found several issues:
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(MY_GRAND_PROJECT) # THis name should be same as below, say "pcd_write_test", right?

find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS}) #using cmake gui, I can't find such variables.
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES}) #and those variables are different with CMake UI displayment as well.
The Cmake file seems having some variables different with what I get from the CMake GUI:
   

After spend some time I got a CMakeList.txt like this:

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(pcd_write_test)
find_package(PCL 1.3 REQUIRED COMPONENTS)
include_directories(${PCL_COMMON_INCLUDE_DIR})

include_directories(/opt/local/include/eigen3/)
include_directories(/opt/local/include/)

link_directories(/usr/local/lib/)
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_COMMON_LIBRARY} ${PCL_IO_LIBRARY})

2. However after configure and generate the xcode project failed to link and reported this:

ld: warning: directory not found for option '-L/usr/local/lib/Debug'

Undefined symbols for architecture x86_64:

  "pcl::PCDWriter::writeASCII(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sensor_msgs::PointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, int)", referenced from:

      pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sensor_msgs::PointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in pcd_write.o

  "pcl::PCDWriter::writeBinary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sensor_msgs::PointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&)", referenced from:

      pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sensor_msgs::PointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in pcd_write.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)



Would please someone help to take a look? This is really frustrated since it's a quite simple project.

I have attached the files I used.

Thanks in advance!CMakeLists.txtpcd_write.cpp