在Ubuntu上编译MRPT教程
Compiling MRPT tutorial on Ubuntu
我正在学习在Ubuntu上使用C++的MRPT库的教程,但我还没有走多远。我根据http://www.mrpt.org/MRPT_in_GNU/Linux_repositories
现在,我正在学习从这个链接用MRPT编写第一个C++程序的教程
我在一个目录中下载并解压了mrpt_example1.tar.gz,但当我使用以下命令运行时:
ccmake .
没有生成代码的选项。MRPT_DIR
已经设置为/usr/share/mrpt
,即MRPTConfig.cmake
的位置,所以ccmake
似乎已经找到了那个位置。我尝试设置其他选项,如CMAKE_BUILD_TYPE
、EXECUTABLE_OUTPUT_PATH
或LIBRARY_OUTPUT_PATH
,但没有帮助。
如何告诉ccmake
实际编译?
您可以直接使用cmake
,而不是使用ccmake
,如下所示:
cmake .
这将在当前目录中生成一个Makefile
。
$ ls -1
CMakeCache.txt
CMakeFiles
cmake_install.cmake
CMakeLists.txt
Makefile
README.txt
test.cpp
然后,您可以运行make
来编译示例程序:
$ make
Scanning dependencies of target mrpt_example1
[ 50%] Building CXX object CMakeFiles/mrpt_example1.dir/test.o
[100%] Linking CXX executable mrpt_example1
[100%] Built target mrpt_example1
然后运行示例程序:
$ ./mrpt_example1
L: (0,4,2)
R: (2.000,1.000,45.00deg)
C: (x,y,z,yaw,pitch,roll)=(0.5000,0.5000,1.5000,-90.00deg,0.00deg,-90.00deg)
R+C:(x,y,z,yaw,pitch,roll)=(2.0000,1.7071,1.5000,-45.00deg,-0.00deg,-90.00deg)
Computation in: 0.0857 us
L': (-3.03553,-0.5,0.207107)
R(+)C(+)L' = (-5.82867e-16,4,2)
Should be equal to L = (0,4,2)
|(R(+)C)-L|= 3.0834
|L-(R(+)C)|= 3.0834
请注意,您应该从提取mrpt_example1.tar.gz
内容的干净副本开始,并在干净副本中执行这些步骤。
或者,您可以使用示例项目的版本,该版本提供开箱即用的Makefile
,并且不需要CMake:
https://github.com/MRPT/mrpt/tree/master/doc/mrpt_example1-with-Makefile
以下教程介绍了这一点:
http://www.mrpt.org/tutorials/programming/first-steps/compiling_custom_applications_in_linux_with_a_makefile_and_pkg-config/
否则,如果必须使用ccmake
:
首先,提取mrpt_example1.tar.gz
内容的干净副本。
输入提取的mrpt_example1
目录并运行:
ccmake .
这将显示一个具有以下选项的交互式对话框:
Press [enter] to edit option
Press [c] to configure
Press [h] for help Press [q] to quit without generating
Press [t] to toggle advanced mode (Currently Off)
按c
进行配置。屏幕顶部现在将显示:
CMAKE_BACKWARDS_COMPATIBILITY *2.4
CMAKE_BUILD_TYPE *
CMAKE_INSTALL_PREFIX */usr/local
EXECUTABLE_OUTPUT_PATH *
LIBRARY_OUTPUT_PATH *
MRPT_DIR */usr/share/mrpt
按c
重新配置。以下选项现在可用:
Press [enter] to edit option
Press [c] to configure Press [g] to generate and exit
Press [h] for help Press [q] to quit without generating
Press [t] to toggle advanced mode (Currently Off)
按g
生成输出文件(包括Makefile
)并退出。
请注意,已经生成了一个Makefile
:
$ ls -1
CMakeCache.txt
CMakeFiles
cmake_install.cmake
CMakeLists.txt
Makefile
README.txt
test.cpp
您可以运行make
来编译示例程序,然后在编译完示例程序后运行该程序,如上所述。
- 生成MRPT库时cmake配置失败
- LLVM 万花筒教程 JIT 编译问题
- 是否需要在 Timer.5 boost::asio 教程中运行新线程?
- WIC 工厂将始终在 Windows7 上为 nullptr("What's a Creel?"教程中使用)
- CMakeLists.txt:(add_executable):没有给目标提供来源:教程
- 使用mingw遵循简单的c ++ DLL教程时出错
- 使用Bazel C++教程;build不创建/使用共享库
- 虚幻引擎4教程不适用于Visual Studio 17
- 如何编译LLVM万花筒教程?
- 虚幻文档中教程项目中的错误
- 编译C 电池收集器教程的错误
- static_assert HANA 教程中的非constexpr对象
- 在遵循 OpenCV 3.4.0 AKAZE 和 ORB 平面跟踪教程时找不到 Points() 函数
- 不了解 learnopengl.com 中漫辐照度教程中的捕获视图
- Freetype库不带有教程代码
- NAO机器人优化了对图像教程的访问
- SDL/C++ && Operator - Lazyfoo 教程
- 用于创建 Windows 应用程序的 MSDN 应用程序教程
- 无法运行 swig 教程
- 在Ubuntu上编译MRPT教程