The integrated development environment of C + +

Source: Internet
Author: User
Tags custom name netbeans

http://blog.csdn.net/pipisorry/article/details/20291219
Linux clion integrated development Environment

JetBrains home, do not introduce Ha, LZ see have its home IDE, must use.

Clion:a Cross-platform IDE for C and C + + [https://www.jetbrains.com/clion/] Download installation

Note: Java is not a Java environment to install first, but also to install CMake.

Download [https://www.jetbrains.com/clion/download/?fromIDE= #section =linux]

Installation 1. After downloading the installation package, unzip the Clion directory, run the clion.sh file to install ~/opt/clion-2017.1.1$ CD bin
~/opt/clion-2017.1.1/bin$./clion.sh &
2.1
If you are prompted to import the configuration file when you enter the IDE, the previous version may already have files, and follow the prompts to automatically import.

2.2
Fix the IDE in the boot bar, if you can't fix it or always start it, you can open it in terminal, then click Tools > Create desktop entry, you can search the dash to open the corresponding Clion program, and then fix it in the boot bar.
In the License option, select License Server input http://bash.pub:1017 and click Active to activate it. or activated by pycharm the same activation code.
the use of Clion Create a new project

Then select the project name and path to create a project, which defaults to a HelloWorld, as shown below

Note:

1 Clion is cmake to manage the project.

2 Project Type: Clion project is output executable program, static library or dynamic library, we can modify CMakeLists.txt.


Build Project

We found after build that the executable program was not under the engineering directory but in other directories, as follows

We passed File–>settings–>build, Execution, Deployment–>cmake


Add bin in build output path: The program's output path

[Installation and use of clion] Project for multiple child project

Create a project

If you already have C code and want to import it directly into Clion, create a project, such as Cpp_workspace, where there is a Cmake-build-debug folder where the C code execution file is.

Copy a C code subdirectory (such as justfortest) to this project, and you may need to delete unwanted files or folders if you previously used vs edit:

Find. -name Debug | Xargs RM-RF
Find. -name ipch | Xargs RM-RF

Find. -name *SDF | Xargs RM-RF
Find. -name *sln | Xargs RM-RF
Find. -name *suo | Xargs RM-RF

Find. -name *vcxproj | Xargs RM-RF
Find. -name *filters | Xargs RM-RF
Find. -name *vcxproj.user | Xargs RM-RF

Directory structure


Writing main code

root directory under Main.cpp

#include <iostream>

int main () {
    std::cout << "Hello, world!" << Std::endl;
    return 0;
}

Configure Cmakelists

Clion is compiled by CMake, so you want to configure the CMakeLists.txt file.

The CMakeLists.txt in the 1 root directory is the CMake file for the entire project:

Cmake_minimum_required (VERSION 3.6)
project (Cpp_workspace)

set (Cmake_cxx_standard)

set (Source_ FILES main.cpp)
#set (source_files oj/oj/ali/alitest.cpp)
#set (source_files oj/oj/io.cpp)
#set (source_ FILES justfortest/justfortest/justfortest.cpp)
add_executable (Cpp_workspace ${source_files})

#ADD_ subdirectory (./justfortest/justfortest)
#ADD_SUBDIRECTORY (./algorithms/algorithms)

After build, the Cpp_workspace file is added to the Cmake-build-debug folder, which is the execution file executable running the. cpp file.

If the file you want to run is another CPP file in a subfolder, you can modify it in cmakelists

Set (Source_files justfortest/justfortest/justfortest.cpp)
You can run a subdirectory of the file, and explain the execution of the language Python almost, very useful.
In fact, if the user will build a CPP file, then Clion will automatically add the new file to the set (SOURCE files ...) In But remember to remove the main function from the previous run code, or two main functions will certainly go wrong.

2 You can, of course, set an executable file for each of the different subdirectories

#ADD_SUBDIRECTORY (./justfortest/justfortest)
Adding subdirectories to Cmakelists declares that after run, the subdirectory justfortest is generated in the Cmake-build-debug directory, and the custom name in the subdirectory Data_ Structure is the cmakelists file in the source file directory Justfortest:
Set (Source_files JustForTest.cpp)
add_executable (Data_structure ${source_files})
The specified name, Data_structure is the executable file for the source file CPP, through the

Configuration.

This is more troublesome, LZ is not very recommended.

[Clion Cmake Multi Target]
shortcut keys and editing tips

[Clion techniques may be useful--mac articles]

C + + source template

Original

#parse ("C File Header.h")

#if (${header_filename})
#[[#include]]# "${header_filename}"
#end

LZ modification

/*
__title__ = ' '
__author__ = ' $USER '
__mtime__ = ' $DATE '
__email__ = ' pipijob@126.com ' *
/* Code is far away from bugs with the god animal protecting
I love animals. They Taste delicious.
*/
#[[#include]]# <stdio.h>
#[[#include]]# <vector>

using namespace Std;

#if (${header_filename})
#[[#include]]# "${header_filename}"
#end
Netbeans IDE Developing C + + programs

NetBeans Ide:fits The Pieces together, Quickly and easily develop desktop, mobile and Web applications with Java, JAVASCR IPT, HTML5, PHP, C + + and more

NetBeans ide 8.1 download Download the corresponding 64-bit C + + version of the NetBeans IDE

Note: Do not install through the apt-get, for a long time did not update, installed incredibly is 7.0 version.
C + + project creation

"File"---> "New Project"

Main.cpp

#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>

using namespace Std;


int main (int argc, char** argv) {
printf ("Hello World!!! \ n ");
GetChar ();
return 0;
}

[C + + Project Quick Start Tutorial]

The final LZ operation result and the interface set the following figure:


Netbeans IDE Related Settings Tools:

Templates > C + + > C++source file > Open in Editor

File templates

< #assign Licensefirst = "/*" >
< #assign Licenseprefix = "*" >
< #assign licenselast = "* *" >
< #include "${project.licensepath}" >
/*
* File: ${name}.${extension}
* Author: ${user}
* Created on ${date}, ${time}
*__email__: ' pipisorry@126.com '
* Code is far away from bugs with the god animal protecting
I love animals. They Taste delicious.
*/

Options>

Keymap changed to Idea (LZ current more accustomed to keymap)

And, of course, like Pycharm, you can save the settings as a file (I'm going to, I can't, just save the project as a zip file, which may be added later)

[NetBeans IDE Docs & Support]

[Best Linux/C + + IDE]

[To talk about the C + + editor (or IDE) I used in Linux environments]

[Commonly-used Linux/C + + IDE]

Del Piero Blog



Windows To write a C + + program in Visual Studio download install Visual Studio Visual Studio writing a C + + program Small Guide

File "new" Project Win32 Console Application: Name Test complete "Next" get rid of precompiled header file complete

You can delete its auto-generated header files: stdafx.h and Targetver.h, and CPP files: stdafx.cpp

Then modify the Test.cpp to resemble the following test program
C + + sample programs

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

int k = 0;
char * s= "3";

Class a{public
:
	void Compute () {
		int64_t value = atoi (s);
		if (value >=k)
			printf ("Good good good!!!");
		System ("pause");       Windows only
	}
};

void Main () {
	a A1;
	A1.compute ();
}
developing C programs in Eclipse installing the CDT in Eclipse

Eclipse->help->install New software->work with->add->name (CDT)

Location:http://download.eclipse.org/tools/cdt/releases/juno

Version to be aligned: Help->about Eclipse view version

Find the location address of the corresponding version of the CDT in http://www.eclipse.org/cdt/downloads.php

Wait for a moment and there will be two options, and then choose the two that you find.

All the way to install

After reboot, window->preferences

Installation is successful to see C + +

from:http://blog.csdn.net/pipisorry/article/details/20291219

Ref


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.