转载:https://blog.csdn.net/WAN_EXE/article/details/56275108
Ubuntu下安装kdevelop,很实用的编写C++代码的工具。
sudo apt-get install kdevelop
就会在Ubutun中看到相应的图标,点击图标,进入程序界面
点击 New Project新建工程
选择standard模式,工程名字为Hello,编译工具cmake,系统会生成两个对应的文件。
main.cpp
- #include <iostream>
- int main(int argc, char **argv) {
- std::cout << "Hello, world!" << std::endl;
- return 0;
- }
- project(hello)
- add_executable(hello main.cpp)
- install(TARGETS hello RUNTIME DESTINATION bin)
- Scanning dependencies of target hello
- [ 50%] Building CXX object CMakeFiles/hello.dir/main.o
- [100%] Linking CXX executable hello
- [100%] Built target hello
- *** Finished ***
- Starting: /home/wang/projects/HelloWorld/build/helloworld
- Hello, world!
- *** Exited normally ***