JetBrains's clion,c++ IDE, to the Linux Programmer's Gospel __ static functions

Source: Internet
Author: User

JetBrains finally put out the IDE of C + +. Currently is 60 days preview version, download: http://www.jetbrains.com/clion/

Main highlights of Clion: The IDE for Linux programs under Windows. Do not dwell on vs is not the King of kings, with vs Open SRS code error on a lump of a lump, not normal use. You can ignore compilation and use it as an editor. Linux code in Windows cannot be compiled, MinGW sometimes, but clion can be used as an editor. Support Basic functions: function jump, class jump, header file jump, HPP and CPP direct jump, smart tips, useless macro definition hints. Support for Findusage: Where functions or classes are used, this feature is useful for code reading and modification. Supports Refactor:rename,extract,move,changesignature,pullmemberup/down's many reduced coolie functions. There is a good thing, select and press CTRL+F, automatically highlighted. This is a very, very common function, better than notepad++. Upp just don't worry about me. Inspectcode, code Check, analyze the potential problems of the code, such as I check the SRS has: 1000 spelling problems, no use of code 200 lines, type check 100, declare the problem 2. Surgery has specialized, JetBrains IDE do very attentively, as long as clion out, I will resolutely abandon upp.

How to use: Openproject, select the SRS trunk directory CMakeLists.txt, click OK.

Linux version, under the CentOS also very useful, need to download cmake2.8:http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz and gdb:http://ftp.gnu.org /gnu/gdb/gdb-7.7.tar.gz, and then specify Toolchain as:/usr/local/bin/cmake and/usr/local/bin/gdb, because the CENTOS6 default CMake and gdb are too old.

In addition, you need Java virtual machines, you can download jdk7, and so on: jdk-7u45-linux-x64.tar.gz, and then edit the environment script: sudo vi/etc/profile, add at the end of the file:

# Winlin
java_home=/usr/local/jdk1.7.0_45
path= $PATH: $JAVA _home/bin
classpath=.: $JAVA _home/bin/ Dt.jar: $JAVA _home/lib/tools.jar
export java_home
export PATH
export CLASSPATH

Suppose Jdk7 decompression in/usr/local/jdk1.7.0_45 words. After extracting the Clion, execute the bin/clion.sh script and execute it under the CentOS graphical interface.

Windows installed under the Clion is very simple, there are installation packages, the installation of the direct import will be done. Linux requires that you install some dependencies, which is not difficult for Linux programmers. If you do not understand, I teach you step-by-step, see the following illustration: install CENTOS6 development version

Choose a graphical interface version, CENTOS6 's development version, or a KDE desktop.

How to install the development version of CENTOS6, ask Niang go, a lot. Install JDK7

You can download Jdk7 or other JDK from the website of Oracle, download Linux version, for example: jdk-7u45-linux-x64.tar.gz, extract to directory:

(sudo mv jdk-7u45-linux-x64.tar.gz/usr/local && cd/usr/local && sudo tar xf jdk-7u45-linux-x64.tar.gz)
Then, modify the environment variables:

sudo vi/etc/profile

Enter the following at the end of the file:

# Winlin
java_home=/usr/local/jdk1.7.0_45
path= $PATH: $JAVA _home/bin
classpath=.: $JAVA _home/bin/ Dt.jar: $JAVA _home/lib/tools.jar
export java_home
export PATH
export CLASSPATH

So the JDK is installed. You can immediately execute the following statement-effective configuration:

Source/etc/profile

This executes Java and finds it.

Install Clion

Clion download after decompression can be used, go to the official website to download a Linux version of: http://www.jetbrains.com/clion/

How to use:

Tar XF clion-138.1965.18.tar.gz

You can start by executing a script in the graphical interface:


The following command is executed:

CD ~/tools/clion-138.1965.18/bin/

Choose the style and interface, set Toolchain, that is, the compilation environment, found CENTOS6 CMake and gdb do not know, version is too old. So compile these two things first.

compiling cmake2.8 and gdb7.7

Download cmake2.8 source and gdb7.7, reference cmake2.8:http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz and gdb:http://ftp.gnu.org/ Gnu/gdb/gdb-7.7.tar.gz, for example:

Tar XF cmake-2.8.12.2.tar.gz && cd cmake-2.8.12.2 &&/configure && make && sudo make inst All

Tar XF gdb-7.7.tar.gz && cd gdb-7.7 &&/configure && make && sudo make install

Then reboot the cliion, or change the CMake and gdb paths to/usr/local/bin/cmake and/usr/local/bin/gdb to identify:

Once the CMake and GDB are identified, the SRS can be compiled and debugged. Import SRS

Import SRS directory, select Open Project (openproject):


Open after CMakeLists.txt file is found (you need to click on that file to do it):


Set Clion, show line number: File/settings/editor/editor/appearance/show lines numbers, hook this up. Debug Clion

Open file: Trunk/src/main/srs_main_server.cpp, set breakpoint in main function:


Then set the working directory and startup parameters, Run/editconfigurations ... ;


Sets the current directory for the SRS and the configuration file:


Then compile and start debugging, you can see the breakpoint, you can set breakpoints elsewhere, and so on.


The main highlights of the

Clion: the IDE for Linux programs under Windows. Do not dwell on vs is not the King of kings, with vs Open SRS code error on a lump of a lump, not normal use. You can ignore compilation and use it as an editor. Linux code in Windows cannot be compiled, MinGW sometimes, but clion can be used as an editor. Support Basic functions: function jump, class jump, header file jump, HPP and CPP direct jump, smart tips, useless macro definition hints. Support for Findusage: Where functions or classes are used, this feature is useful for code reading and modification. Supports Refactor:rename,extract,move,changesignature,pullmemberup/down's many reduced coolie functions. There is a good thing, select and press CTRL+F, automatically highlighted. This is a very, very common function, better than notepad++. Upp just don't worry about me. Inspectcode, code Check, analyze the potential problems of the code, such as I check the SRS has: 1000 spelling problems, no use of code 200 lines, type check 100, declare the problem 2. Surgery has specialized, JetBrains IDE do very attentively, as long as clion out, I will resolutely abandon upp.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.