在Ubuntu环境下,如果进行代码编辑或者调试、发布,完全依赖vim,对于新手来说有点困难,这里我们推荐使用kdevelop进行代码调试及发布。Kdevelop是一个自由、开放源代码的IDE,支持Linux,Solaris,FreeBSD,Mac OS X,WIndows 以及其他类Unix系统,它是一个功能全,可扩展的IDE。
KDevelop支持多种不同语言,其中包括C、C++、脚本等。支持的构建系统包括GNU(automake)、cmake、qmake和自定义项目的make(如果您想使用自己的Makefile,KDevelop不会破坏它们的)以及不需要Makefile的脚本项目。
好,下面我们就介绍一下使用:
1. 安装GCC
sudo apt-get build-dep gcc
sudo apt-get install build-essential
2. 安装kdevelop
sudo apt-get install Kdevelop
3. 安装CMake
sudo apt-get install automake autoconf g++ libtool cmake
4. PCL 安装
W: Failed to fetch http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
在Software&Updates中,Other Software窗口将ppa.launchpad.net选项去掉,close即可。
接下来,我们就可以通过命令行或者Search窗口进行打开kdevelop了。
// 创建新工程
Project -> New from template. Select C++ -> No GUI (Cmake) -> Simple CMake-based C++ application and edit the name on the bottom of the window and click Next.
Then appears Version Control System. Select None and click Finish.
// 编译工程
Then it asks you to configure build. Click Ok. Now you should have new project visible on Projects list. You can build it by pressing F8 or selecting Project -> Build Selection.
// 配置启动项
To debug an application you must add launch configuration. This is done from Run-> Configure Launches.
Add new launch by pressing +. You need to edit the Project Target field to point a executable binary. It is same as your project name usually. Or you can just select executable to point the binary. You can also edit the launch name to be more informative than New Native Application Configuration by selecting it on left Launch Configurations list and pressing F2. Apply changes pressing Ok. Then you can add breakpoint to source code with right click -> Toggle Breakpoint. Debugging starts with Run -> Debug launch. On bottom of the screen you can select gdb console tab, and you can use enter commands gdb console.
// 导入工程
Project -> Open/Import project and select the folder of your project.
Alternatively select your main makefile or <strong>CMakeLists.txt.</strong> Follow the wizard.
// 运行程序
Run -> Configure Launches, select your project to the left, press the plus-button. Make sure the type of the new launch configuration (give it a proper name!) is Native Application. Now go to the Project target field to the left and type in the path to your target. Start with your projects name, it has auto completion.
好,上面就是kdevelop的工程创建及调试流程,新建的工程通过后,会在目录生成发布的版本所需的所有文件。
https://userbase.kde.org/KDevelop4/FAQ#How_do_I_import_an_existing_project.3F