å æ¥ãCLion 2018.3ããªãªãŒã¹ããŸããã ä»å¹Žã®3çªç®ã®ã¡ãžã£ãŒãªãªãŒã¹ã§ã¯ã èšèªãµããŒãã®æ¹åãšãªã¢ãŒãéçºã® 2ã€ã®éèŠãªéçºåéã§ã®äœæ¥ããŸãšããŠããŸãã
ããã«ãæçµçã«ïŒ
- ã³ãŒããããã¡ã€ãªã³ã°ããŒã«ãè¿œå ã
- 1ã€ã®ãã¡ã€ã«ãè€æ°ã®ã¿ãŒã²ããããŸãã¯ãããžã§ã¯ãå šäœã®ã¬ãã«ã§ã³ãŒããã¢ã»ã³ãã«/åã¢ã»ã³ãã«ããããã®ãšãã£ã¿ãŒã®ã³ãã³ããåç·šéããŸãã
- ä»ã®IntelliJãã©ãããã©ãŒã ããŒã¹ã®IDEãšãšãã«ãGitãµãã¢ãžã¥ãŒã«ãšGitHubãã«ãªã¯ãšã¹ãã®ãµããŒããè¿œå ããŸããã
- IDEã®å¯èœæ§ãžã®ãŠãããŒãµã«ã¢ã¯ã»ã¹ã®æ¹åãããæ段ïŒã¢ã¯ã»ã·ããªãã£ïŒã
ãããããã³ãã®ä»ã®é©æ°ã«ã€ããŠã¯ã以äžãã芧ãã ããã ãŸããæ°æ©èœãæ¹åç¹ãè©Šãã«ã¯ãç¡æã®30æ¥éããŒãžã§ã³ãWebãµã€ãããããŠã³ããŒãããŠãã ãã ã
C ++èšèªã®ãµããŒã
ãã®ä»ã®C ++ 17
CLionããŒãµãŒã¯ãC ++ 17æšæºæãããã¿åŒãšæŒguideã¬ã€ãã® 2ã€ã®æ°ããæ©èœãç解ããããšãåŠã³ãŸããã äžæ¹ã§ãããŒãµãŒã®å€æŽã¯ãŸã å®å šã«ã¯ãµããŒããããŠããŸããããå°ãªããšãã³ãŒãã®åŒ·èª¿è¡šç€ºã¯ããæ£ç¢ºã«ãªãã ãŠãŒã¶ãŒå®çŸ©ã®æŒguideã¬ã€ãã®å Žåã IDEã¯ã¿ã€ããæ£ãã衚瀺ããããšãã°ãé¢æ°ãã©ã¡ãŒã¿ãŒã
Clangdã¯çŸåšããã²ãŒã·ã§ã³äžã§ã
ååãç§ãã¡ã¯CLionãC / C ++ã³ãŒããæäœããããã«ç¬èªã®èšèªãšã³ãžã³ã ãã§ãªããClangdã«åºã¥ããŠäœæãããå®éšçãªè¿œå ãšã³ãžã³ã䜿çšããããã«ãªã£ãããšãæžããŸããã ãšãã£ã¿ãŒã§ãšã©ãŒãšèŠåã衚瀺ããããã«ããããªã³ã«ããŠãCLion 2018.3ã«é²ã¿ãããã«åºã¥ããŠã³ãŒãããã²ãŒã·ã§ã³ãšã³ãŒãæ€çŽ¢ã®ããã€ãã®ã¢ã¯ã·ã§ã³ãå®è£ ããŸããã
ClangdããŒã¹ã®èšèªãšã³ãžã³ã¯çµæãæäŸãããã®åŸãCLionç¬èªã®ãšã³ãžã³ããååŸããçµæãšçµã¿åãããŸãã å žåçãªäŸã¯ã䜿çšç¶æ³ã®æ€çŽ¢ïŒ
Alt+F7
ïŒã§ããClangdã¯ãšãã£ã¿ãŒã§éããããã¡ã€ã«ãæ€çŽ¢ããç¬èªã®ãšã³ãžã³ãæ®ããæ€çŽ¢ããŸãã
Clangdèšèªãšã³ãžã³ãè¿œå ã§äœ¿çšããä»ã®ã¢ã¯ã·ã§ã³ã®äŸïŒ
- 宣èšã«ç§»åïŒ
Ctrl+B
/âB
ïŒ/å®çŸ©ã«ç§»åïŒCtrl+Alt+B
/â¥âB
ïŒ - ã«ãŒãœã«ã眮ãããŠããã·ã³ãã«ã®ãã¹ãŠã®å å«ç©ã匷調衚瀺ããŸã
- ã¯ã€ãã¯ããã¥ã¡ã³ããŒã·ã§ã³ïŒ
Ctrl+Q
/F1
ïŒ
Clangdã¯ããã©ã«ãã§æå¹ã«ãªã£ãŠãããèšå®/ç°å¢èšå®ã§æ§æãããŠããŸã| èšèªãšãã¬ãŒã ã¯ãŒã¯| C / C ++ | ã¯ã©ã³ãïŒ
ã€ãŸããClangdã®äžã§å¿ èŠãªæ©èœãåå¥ã«æå¹/ç¡å¹ã«ããããšãã§ããŸããããšãã°ããšã©ãŒã®ã¿ã衚瀺ããããããã²ãŒã·ã§ã³ã®ã¿ã衚瀺ãããã§ããŸãã Clangdã®äœ¿çšãå®å šã«ç¡å¹ã«ããå¿ èŠãããå Žåã¯ããã®ãã€ã¢ãã°ã®ãã¹ãŠã®ããã¯ã¹ããªãã«ããŸãã
ã¡ãªã¿ã«ãClang-Tidyã¯Clangdãªãã§å®è¡ã§ããŸãããClangdã§ãã£ãã·ã¥ãããASTããªãŒã䜿çšãããããClangdãå®è¡ãããšããã©ãŒãã³ã¹ãå€§å¹ ã«åäžããŸãã
ãªã¢ãŒãéçº
CLion 2018.1ã®ãªãªãŒã¹ã§ã¯ãWindowsã§Linuxã®Windows SubsystemïŒWSLïŒãµãã·ã¹ãã ãšé£æºããæ©èœãå°å ¥ãããŸããã Windowsã«çµã¿èŸŒãŸãããã®Linuxç°å¢ã«ãããWindowsäžã§Linuxã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ãå®è¡ããããã°ã§ããŸãã 次ã«ãsshãä»ããŠãã€ãŸããªã¢ãŒããµãã·ã¹ãã ãšããŠWSLã®ãµããŒããå ·äœçã«å®è£ ãããšè¿°ã¹ãŸããã ããã¯ãå®å šã«ãªã¢ãŒãæ§æã§äœæ¥ããããã®æåã®ã¹ãããã§ããã
ãã®ãããCLion 2018.3ã§ã¯ããªã¢ãŒãéçºã®æåã®å€§èŠæš¡ããŒãžã§ã³ã®ãµããŒããçºè¡šããŸããã
- CLionãå®è¡ãããŠããããŒã«ã«ãã·ã³ã§ã¯ãLinuxãWindowsããŸãã¯macOSã®å¯èœæ§ããããŸãã
- CLionãã¢ããªã±ãŒã·ã§ã³ããã«ããããããå®è¡ããã³ãããã°ãããã¹ããå®è¡ãããªã¢ãŒããã·ã³äžã§ã¯ããããŸã§ã®ãšããLinuxããååšã§ããŸããã
- ã³ãŒãã¯ããŒã«ã«ãã·ã³äžã«ãããšæ³å®ãããŸãã CLionèªäœã¯ããããªã¢ãŒããã·ã³ãšåæããããããŒæ€çŽ¢ãã¹ãããŒã«ã«ãã¹ã«æ»ãããšãã£ã¿ãŒã§ã³ãŒãããã°ãã解決ããŸãã åæã¯ãããŒã«ã«ãã·ã³ãšããŠã®LinuxãŸãã¯macOSã®å Žåã¯rsync ãWindowsã®å Žåã¯sftpããã³gzipãä»ããŠè¡ãããŸãã
- ãããŸã§ã®ãšãããCMakeã®ãããžã§ã¯ãã§ã®ã¿æ©èœããŸãã
ãã®ãããªãªã¢ãŒãæ§æã®ã»ããã¢ããã¯éåžžã«ç°¡åã§ã-èšå®/ç°å¢èšå®|ãªã¢ãŒãããŒã«ãã§ãŒã³ã§ãªã¢ãŒãããŒã«ãã§ãŒã³ãäœæããã ãã§ãã ãã«ããå®è¡ãå±é| ããŒã«ãã§ãŒã³ãšããã€ãã®CMakeãããã¡ã€ã«ã§äœ¿çšããŸãã 詳现ãªæé ã¯ã è±èªã®ããã°ãšãªã³ã©ã€ã³ããã¥ã¡ã³ãã«èšèŒãããŠããŸã ã ãªã¢ãŒããã¹ããšã®åæã®é²è¡ç¶æ³ã¯ã[ãã¡ã€ã«è»¢é]ãŠã£ã³ããŠïŒ[衚瀺] | [ããŒã«ãŠã£ã³ããŠ] | [ãã¡ã€ã«è»¢é]ïŒã«è¡šç€ºããã[èšå®]ã®[èšå®]ã§ãªã¢ãŒããã·ã³ã®æ¥ç¶ãã©ã¡ãŒã¿ãŒãšãã£ã¬ã¯ããªãã¹ãå€æŽããŸã ãã«ããå®è¡ãå±é| å±é
ãã®æ¹åã§å€ãã®äœæ¥ãæåŸ ãããŸãã ããã§ãããããã«ããªã¢ãŒããã·ã³ã§ã³ãŒããçŽæ¥æ€çŽ¢ãããªãã·ã§ã³ã¯ãµããŒããããŠããŸããããªã¢ãŒãããŒãžã§ã³ç®¡çã·ã¹ãã ã¯ãµããŒããããŠããŸããããªã¢ãŒãã¿ãŒããã«ãšã®çµ±åã¯ãããŸããããŸããæ¥ç¶èªäœã«å€ãã®å°ããªæ¬ é¥ããããŸãã ããããäž»ãªããšã¯-CLionã䜿çšãããªã¢ãŒãéçºãå¯èœã«ãªã£ãããšã§ãïŒ
ã«ã¹ã¿ã ã³ãŒãããã©ãŒãã³ã¹åæ
CLion 2018.3ã¯ãã³ãŒãã®ããã©ãŒãã³ã¹ãåæããæ©èœãæäŸããŸãã Linuxã§ã¯Perfãšã®çµ±åãæäŸãããmacOSã§ã¯DTraceãšã®çµ±åãæäŸãããŸãã æ°ããã¢ã¯ã·ã§ã³ã¯ã[å®è¡]ã¡ãã¥ãŒãããã²ãŒã·ã§ã³ããã«ãããã³ã¢ããªã±ãŒã·ã§ã³èµ·åã¢ã€ã³ã³ã®ã³ã³ããã¹ãã¡ãã¥ãŒã§äœ¿çšã§ããŸãã ã³ãŒããããã¡ã€ãªã³ã°ã®çµæã¯ãCPUãããã¡ã€ã©ãŒãŠã£ã³ããŠïŒè¡šç€º|ããŒã«ãŠã£ã³ããŠ| CPUãããã¡ã€ã©ãŒïŒã§å©çšã§ããŸãã
ã³ãŒããããã¡ã€ãªã³ã°ãæ©èœããããã«ã³ã³ãã¥ãŒã¿ãŒã«ã€ã³ã¹ããŒã«ããå¿ èŠããããã®ã®è©³çŽ°ã«ã€ããŠã¯ã ããã°ãŸãã¯ãªã³ã©ã€ã³ããã¥ã¡ã³ããåç §ããŠãã ãã ã
UI / UXã¯ãŸã å®éšçãªãã®ã§ããããšã«æ³šæããŠãã ããã ããŒãžã§ã³2019.xã§ã¯å€§å¹ ã«æ¹åãããäºå®ã§ãã ãããããã¹ãŠã®ã¹ã¬ããããŸãšããŠããŸãã¯äžåºŠã«1ã€ãã€è¡šç€ºããæ©èœããœãŒã¹ã³ãŒãã«ããã²ãŒãããæ©èœãªã©ãæ¢ã«äŸ¿å©ãªãã®ããããŸãã
ãã«ãããã³ãªãã«ãã³ãã³ã
ãã«ãã³ãã³ãã®ããŸããŸãªçµã¿åããã®æ°ãéåžžã«å€ããªã£ãããããããããã¹ãŠå¥ã®ã¡ãã¥ãŒé ç®-ãã«ãã«å ¥ããããšã«ããŸããã ãããžã§ã¯ãå šäœã®ã¢ã»ã³ããª/åã¢ã»ã³ããªãããã³ãã¹ãŠãŸãã¯éžæããCMakeãããã¡ã€ã«ãããã³éžæããæ§æããã®
all
ã¿ãŒã²ãããããã³1ã€ã®ç¹å®ã®ãã¡ã€ã«ããããŸãã
ãã¡ãããããã¯CMakeçšã§ãã ã³ã³ãã€ã«ããŒã¿ããŒã¹ã®å Žåãç¹å®ã®ãã¡ã€ã«ã«å¯ŸããŠã®ã¿åæ§ç¯ã³ãã³ãããããŸãã
ãŠãããŒãµã«ãã€ã¢ãã°ïŒäœã§ãå®è¡ããŠã©ãã§ãæ€çŽ¢
CLionãŠãŒã¶ãŒã¯ãã©ãã§ãæ€çŽ¢ïŒ
Double Shift
ïŒãã€ã¢ãã°ãããã³ååã§ã³ãã³ããŸãã¯èšå®ãæ€çŽ¢ããã¢ã¯ã·ã§ã³ã®æ€çŽ¢ãã€ã¢ãã°ïŒ
Ctrl+Shift+A
/
â§âA
ïŒãããã³ãã¡ã€ã«ããã£ã©ã¯ã¿ãŒãã¯ã©ã¹ã«ç§»åããããã®ãã€ã¢ãã°ã«
â§âA
ã§ããŸãååã ãããŠä»ãããã¯å®éããŸã£ããåã察話ã§ãïŒ
åå¥ã®ãã€ã¢ãã°ãåå¥ã®ã¿ãã«å€ãããåãæ¿ãã¯
Tab
ä»ããŠæ©èœã
Tab
ã åæã«ããã©ãŒã«ã¹ã®åªå€±ãäžæ£ç¢ºãªãµã€ãºãªã©ããããã®ãã€ã¢ãã°ã«é¢é£ããå€ãã®åé¡ãæé€ããŸããã
å¥ã®æ°ããæ®éçãªãã€ã¢ãã°ã¯ãäœã§ãå®è¡ïŒ
Double Ctrl
ïŒã§ãã ãããããã¢ããªã±ãŒã·ã§ã³ãéåžžã¢ãŒããŸãã¯ãããã¬ãŒããå®è¡ãããããžã§ã¯ããéãããšãã§ããŸãã
compilation_database.jsonã®ãã§ãã¯ã€ã³
ã³ã³ãã€ã«ããŒã¿ããŒã¹ã¯ãCLionã以åãããµããŒãããŠãã代æ¿èšèšã¢ãã«ã§ãã äºå®äžã人æ°ã®ããããŸãã¯ã«ã¹ã¿ã ã®ãã®ä»ã®ãã¶ã€ã³ã¢ãã«ãããå ¥æã§ãããšããç¹ã§éåžžã«äŸ¿å©ã§ã ã CLionã¯ãã³ã³ãã€ã«ããŒã¿ããŒã¹ãããããžã§ã¯ããéããã³ãŒããæ£ãã解æããã³ãŒããæäœããããã®ãã¹ãŠã®ã¹ããŒããªæ段ãæäŸã§ããŸãã å¯äžã®ãã€ãã¹ã¯ããã®åœ¢åŒã®ãããžã§ã¯ãå šäœã®ã¢ã»ã³ããªã«é¢ããæ å ±ããªãããšã§ãããããŸã§ã®ãšãããåã ã®ãã¡ã€ã«ã®ã¿ãIDEããåéãããŸãã
ãã®ãªãªãŒã¹ã§ã¯ããã¡ã€ã«comp_database.jsonã®ã¹ããŒã ãCLionã«è¿œå ãããã®ã¹ããŒã ã«åºã¥ããŠããã¡ã€ã«èªäœã«ãã§ãã¯ãå®è£ ããŸããã ããšãã°ãããããã£ã®å€ã®ã¿ã€ããæ£ãããªãããŸãã¯äžè¬çã«æ¬ èœããŠããããããã£ïŒ
ãã®ãããªãã¡ã€ã«ãæåã§æžã蟌ãããæ¢åã®ãã¡ã€ã«ãä¿®æ£ããããšã決å®ããå Žåããã§ãã¯ã¯éåžžã«åœ¹ç«ã¡ãŸãã
ãšãã£ã¿ãŒã®ããã©ãŒãã³ã¹ãšãã¹ã
ãŠãŒã¶ãŒããã®å€ãã®ãã³ãã§ã¯ãIDEã®ããã©ãŒãã³ã¹ã«é¢ããé倧ãªåé¡ã¯ãIDEããããžã§ã¯ãã§äœ¿çšå¯èœãªãã¹ãã®ãªã¹ãã決å®ããæ¹æ³ã«é¢é£ããŠããããšãããããŸããã ããŒãžã§ã³2018.3ã§ã¯ããã®ããã»ã¹ãé 延ãããŸãããçŸåšããšãã£ã¿ãŒã§ãã¹ããã¡ã€ã«ãéããŠããªãå Žåã¯ãã€ã³ããã¯ã¹ãäœæãããŸããã ããã«ããã¹ãçµæãžã®ããã²ãŒãããã¹ããã¯ãã®ãªãŒãã³ã³ããªãŒããªã©ã®ããã©ãŒãã³ã¹ãåäžããŸããã
ãšãã£ã¿ãŒã®æ©èœåŒ·å
ãåãã®ããã«ãã¯ã€ãã¯ããã¥ã¡ã³ããŠã£ã³ããŠïŒ
Ctrl+Q
/
F1
ïŒã§ãCLionã¯ã³ãŒãã«é¢ããããã¥ã¡ã³ããšã³ã¡ã³ãã ãã§ãªããå€æ°ã®æšè«ãããã¿ã€ããšãã¯ãã®æçµçãªçœ®æã衚瀺ã§ããŸãã ãã®æçµã«ãã¯ã¢ããã¯ãã©ãŒããããããããŒã¯ãŒãã匷調衚瀺ãããŸãã Boostãªã©ãããã€ãã®ã¬ãã«ã®ãã¹ããæã€è€éãªãã¯ãã«éåžžã«äŸ¿å©ã§ãã
TODOã³ã¡ã³ãã¯è€æ°è¡ã«ã§ããããã«ãªããŸãããäž»ãªããšã¯2è¡ç®ä»¥éã®ã€ã³ãã³ãã§ã-CLionã¯ãããTODOã³ã¡ã³ãã®äžéšã§ããããšãèªåçã«ç解ããŸãïŒ
ååãªã³ã³ãã©ã¹ãããªããããæšæºããŒãã䟿å©ã§ã¯ãªããŠãŒã¶ãŒãããŸãã 圌ãã®ããã«ãç¹å¥ãªãã€ã³ã³ãã©ã¹ãããŒããè¿œå ããŸããã ã³ãŒããšãã£ã¿ãŒïŒCtrl + `ïŒãŸãã¯IDEå šäœïŒ[èšå®/èšå®] | [å€èŠ³ãšåäœ] | [å€èŠ³] | [ããŒã]ïŒã§ã®ã¿æå¹ã«ã§ããŸãã
IntelliJ Platformãšäžç·ã«ãIDEã®ãã©ã°ã€ã³èšå®ã¡ãã¥ãŒãåèšèšããŸããïŒ[èšå®] / [èšå®] | [ãã©ã°ã€ã³]ïŒã ã€ã³ã¹ããŒã«ããããã©ã°ã€ã³ãææ°ã®ç¶æ ã«ä¿ã¡ãæ¢åã®IDEãã©ã°ã€ã³ã®å·šå€§ãªãªããžããªããœãŒãããã³ãã£ã«ã¿ãŒåŠçããããšãã¯ããã«ç°¡åã«ãªããŸããã
ããŒãžã§ã³ç®¡çã·ã¹ãã
ãã1ã€ã®äž»èŠãªãã©ãããã©ãŒã ã®å€æŽã¯ãåŸ æã®Gitãµãã¢ãžã¥ãŒã«ã®ãµããŒãã§ãã ããã§ãCLionã§VCSãæäœããããã®ãã¹ãŠã®æäœããµãã¢ãžã¥ãŒã«ã«ãã£ãŠèæ ®ãããŸãïŒãããžã§ã¯ãã®è€è£œãæŽæ°ãããŒãžã§ã³æ¯èŒïŒdiffïŒãªã©ã
GitHubãã«ãªã¯ãšã¹ããŠã£ã³ããŠãè¿œå ãããŸããããã®ãŠã£ã³ããŠã§ã¯ããã¹ãŠã®ãã«ãªã¯ãšã¹ãã衚瀺ã§ããã ãã§ãªããäœæè ãŸãã¯ç¶æ ã§æ€çŽ¢/ãã£ã«ã¿ãªã³ã°ããããšãã§ããŸãã ãŸãããã«ãªã¯ãšã¹ãããã¯ã³ã¯ãªãã¯ã§æ°ãããã©ã³ããäœæã§ããŸãã
ãã¢
CLion 2018.3ã®æ°æ©èœã«é¢ããè±èªã®åŸæ¥ã®ãããªïŒ
次ã¯ïŒ
æ¥å¹ŽãClangdã«åºã¥ã2çªç®ã®è¿œå èšèªãšã³ãžã³ã§ã®äœæ¥ãç¶ç¶ããäºå®ã§ããClangdã«å®è£ ã§ããä»ã®IDEæ©èœãèŠãŠã¿ãŸãããã ç·šéè ã®çç£æ§ãåäžãããæ¢åã®æ©èœãä»äžããŠæ¹åããŸãã CLionã§ã®ãªã¢ãŒãéçºããµããŒãããäœæ¥ã¯ç¹ã«å€æ§ã«èŠããŸãã çµ±åãããclang-formatãèšç»ãããããããWindowsãŸãã¯MSVCçšã®ãããŸãã¯ãã®ãããã¬ãŒãèšç»ããŸãã
ãããŠãç§ãã¡ã®äž»ãªçŠç¹ã¯ã çµã¿èŸŒã¿éçºã§ãã ããæè¿ãCLion OpenOCD + STM32CubeMXã§éåžžã«äººæ°ã®ãããµããŒããã©ã°ã€ã³ã®äœæè ã§ããElmotãããŒã ã«å ãããŸããã Ilyaã¯åŒãç¶ããã®æ©èœãIDEã«çµ±åããŸãããè¿ããã¡ã«ã¡ã¢ãªãã¥ãŒãå®æããã16é²ãã¥ãŒãäœãçŽãäºå®ã§ãã
質åãé¡ãããã°å ±åããããŠåãªãèããã³ã¡ã³ãã§è¡šçŸãããŠããŸãïŒ åãã§ãçãããŸãã
JetBrains CLionããŒã
éçºãžã®æ欲