The second step is to use CLion normally

Keywords: cmake Java Programming IntelliJ IDEA

1.CLion editor

1) JetBrains

JetBrains is a Czech software development company, which is located in Prague, Czech Republic, and has offices in St. Petersburg, Russia and Boston, Massachusetts, USA. its most well-known product is the integrated development environment used for Java programming language development and writing: IntelliJ IDEA.
JetBrains was founded in 2000 as a privately held company with partners Sergey Dmitriev, Eugene Belyaev and Valentin Kipiatkov.

2) Clion compiler

CLion - cross platform C/C++ IDE development tool, supporting C++11, C++14, libc + + and Boost.

Product overview: Main functions:
CLion is a cross platform IDE designed for the development of C and C + +. It is designed on the basis of IntelliJ and contains many intelligent functions to improve the productivity of developers. This powerful IDE helps developers to develop C/C + + on Linux, OS X and Windows. At the same time, it also uses intelligent editor to improve code quality, automatic code reconstruction and deep integration of CMake compiling system, so as to improve the working efficiency of developers. Provides C and C + + support (including C++11, libc + + and Boost), as well as JavaScript, XML, HTML and CSS. Cross platform. Provide support for CMake. Provide various coding AIDS. Safe and reliable automatic code refactoring function. Code analysis function. It integrates GDB debugger and expression function, STL container renderer, watches, embedded variable view, etc. Integration with the hottest version control systems: Subversion, Git, GitHub,Mercurial, CVS, Perforce, and TFS. Built in terminal mode and can provide VIM simulation mode through plug-in implementation. The intelligent editor CLion's intelligent editor can help developers to complete the code faster, while maintaining the developer's code format and conform to the style of configuration coding. With this intelligent editor, you can quickly select code blocks and reorder them. Code generation and refactoring in CLion, developers can use previously defined published functions, variables, data members or a class, which will be highlighted in red in the IDE. At the same time, CLion also provides a set of reliable refactoring to help developers maintain the quality of the code. This code refactoring is applicable to the whole scope of change.

2. Distribution environment

1) Download a Dev-C + + first.

Portal

2) Configure c + + Environment

Find MINGW64 (some people are 32-bit machines) in the Dev-C + + installation directory, and put the bin directory in the environment variable


To test whether the environment is well configured, it is necessary to restart the computer
Open command line input:

gcc -v
g++ -v


Content output indicates that the environment is well configured.

3) Configure the CLion editor

Turn on settings in FIle

Select MinGW64 under Dev-C + + directory in Tool chains, and wait. When 4 displays the green check mark, the recognition is successful
Write a helloword and output normally.

#include <iostream>

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

Bugs encountered

The first time you create a project, you will get the following error and the bug will not turn green

"C:\Program Files (x86)\JetBrains\CLion 2019.2.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/mingw32-make.exe -DCMAKE_C_COMPILER=G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/gcc.exe -DCMAKE_CXX_COMPILER=G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/g++.exe -G "CodeBlocks - MinGW Makefiles" G:\C++Resources forgA kind of\Hello
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/gcc.exe
-- Check for working C compiler: G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/JetBrains/CLion 2019.2.2/bin/cmake/win/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: G:/C++YanㄥI'm sorryTechnetium exchange/Hello/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/mingw32-make.exe cmTC_f23b4/fast 
    G:/CLanguageEditor/Dev-Cpp/MinGW64/bin/mingw32-make.exe -f CMakeFiles\cmTC_f23b4.dir\build.make CMakeFiles/cmTC_f23b4.dir/build
    mingw32-make.exe[1]: Entering directory 'G:/C++YanㄥI'm sorryTechnetium exchange/Hello/cmake-build-debug/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_f23b4.dir/testCCompiler.c.obj
    G:\CLanguageEditor\Dev-Cpp\MinGW64\bin\gcc.exe    -o CMakeFiles\cmTC_f23b4.dir\testCCompiler.c.obj   -c G:\C++He is a great manFlower worldKey type Hello\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c
    gcc.exe: error: G:\C++He is a great manFlower worldKey type Hello\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
    gcc.exe: fatal error: no input files
    compilation terminated.
    CMakeFiles\cmTC_f23b4.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_f23b4.dir/testCCompiler.c.obj' failed
    mingw32-make.exe[1]: *** [CMakeFiles/cmTC_f23b4.dir/testCCompiler.c.obj] Error 1
    mingw32-make.exe[1]: Leaving directory 'G:/C++YanㄥI'm sorryTechnetium exchange/Hello/cmake-build-debug/CMakeFiles/CMakeTmp'
    Makefile:120: recipe for target 'cmTC_f23b4/fast' failed
    mingw32-make.exe: *** [cmTC_f23b4/fast] Error 2
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "G:/C++YanㄥI'm sorryTechnetium exchange/Hello/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "G:/C++YanㄥI'm sorryTechnetium exchange/Hello/cmake-build-debug/CMakeFiles/CMakeError.log".

[Previous CMake output restored: 2020/6/19 12:46]

Solution: Chinese is not allowed in the path of the project

Posted by chronomantic on Thu, 18 Jun 2020 22:53:48 -0700