4æ27æ¥ ãš 28æ¥ ã®ãšã³ããªãŒã«ã確ççµ±èšã®åå匷äžã§ããããšãæžãããé«æ ¡æ代ããæã£ãŠããã®ã ããçãã®æ£ç¢ºæ§ãæ ä¿ãããã®ããªãããšã«ãã€ãã€ãäžæºãæãããåé¡éã ã£ããå·»æ«ã«çããèŒã£ãŠããããçŸå®ã«çŽé¢ããåé¡ã«ã¯ãããããã®ã¯ãªããããééãããééãã£ã±ãªããããªãããšããããšã§ããããããŠäººéã¯å¿ ãééããç¯ãååšãªã®ã ã
ã®ã£ããã話ã¯ãºã¬ããããã®ç¹ãè€åŒç°¿èšã£ãŠãããã§ããã貞åå¹³åã®åçãšããã®ã«åºã¥ããŠãééããæ€åºããã·ã¹ãã ãæ§ç¯ãããŠããããããééããªã人é¡ã®å倧ãªç¥çéºç£ã®äžã€ã ãšæã£ãŠããããã£ãšå匷ããã°ãšæãã€ã€æãããŠããªãã
ã¹ãã³ãµãŒãªã³ã¯
Â
Â
話ãæ»ããŠãé«æ ¡æ代ã«æ¯ã¹ãŠä»ã®èªåã¯ç¡é§ã«å¹Žãåã£ãããã§ãªããã¡ã£ãšã¯ç¥èãèç©ããŠããã¯ãã ãããã«æãã€ãã®ã¯ãç°¡åãªããã°ã©ãã³ã°ã«ãã£ãŠã·ãã¥ã¬ãŒã·ã§ã³ãããããšã ã£ããããããã·ã³ã®æŽæ°ãWindowsã®ã¢ããããŒãã«ãã£ãŠããã€ãŠã®éçºç°å¢ãã©ã£ãè¡ã£ãŠããŸããä»æã£ãŠããã·ã³ã§ã¯C++ã®ã³ã³ãã€ã«ãã§ããªããªã£ãŠããã
Borland C++ã³ã³ãã€ã©ã«å§ãŸããBorland C++ BuilderãTurbo C++Explorerãããã«JAVAã³ã³ãã€ã©ïŒJDKïŒãEclipseãšãå ¥ããã ãã¯ããããªãã®ãå ¥ããŠãããã ãã©ãªãç¹ã«C++ Builderã¯ãããªãŒãããªãããåºè²»ãçãã£ãã
Windows10ã®åŒ·å¶ã¢ããããŒãã¯ç§ã«ãšã£ãŠè¿·æãªã ãã ã£ããã確ãWindows10ããbashãªããã®ãå©çšå¯èœã«ãªããgccãg++ã䜿ããããã«ãªã£ããšèãããã£ãèšæ¶ããã£ãã®ã§ãæ€çŽ¢ããŠã¿ããgccã¯Cèšèªã§æžãããããã°ã©ã ããg++ã¯C++ã§æžãããããã°ã©ã ãã³ã³ãã€ã«ããã³ãã³ãã§ããã
ããã€ãèšäºãããããããMinGWãªããã®ãã€ã³ã¹ããŒã«ãããšãWindowsã§gccãg++ã䜿ããããã«ãªããšã®ããšã§ããããªãWindows10ãããšããã®ã¯ç§ã®èª€è§£ã§ãMinGWã¯Windowsã®ä»¥åã®ããŒãžã§ã³ã«ãã€ã³ã¹ããŒã«å¯èœãšã®ããšã ã£ããã³ã³ãã€ã«ãã§ããã°ã©ã£ã¡ã§ãããã®ã ã
ãããã®èšäºãåèã«ãMinGWãã€ã³ã¹ããŒã«ããŠã¿ããçè ã®æ¹ã ã«æè¬ããŸãããªãããã°ã¿ã€ãã«ã®ãGWã ããããšããã®ã¯åè«ã§ãã
ãŸãã¯MinGWã®HPãããã€ã³ã¹ããŒã©ãããŠã³ããŒãããŠå®è¡ããã
MinGW | Minimalist GNU for WindowsïŒè±æïŒã®å³äžã«ãDownload Installerããšãããã¿ã³ãããããã¯ãªãã¯ããã°ããã
ã€ã³ã¹ããŒã©ã®åæç»é¢ã
ãInstallããã¿ã³ãã¯ãªãã¯ããã
ãã§ãã¯ãã¿ã³ãšã©ãžãªãã¿ã³ãäžããæèš³ããã°ã©ãã£ãã¯ãŠãŒã¶ã€ã³ã¿ãã§ãŒã¹ã®ãµããŒããã€ã³ã¹ããŒã«ããŸããããããã®ãŠãŒã¶ã®ã¿ïŒãã¹ãŠã®ãŠãŒã¶ãããã¹ã¿ãŒãã¡ãã¥ãŒã«ã¢ã€ã³ã³ãè¿œå ããããã¹ã¯ãããã«ã¢ã€ã³ã³ãè¿œå ãã€ã³ã¹ããŒã«å ãã©ã«ãå«ããŠãã¹ãŠããã©ã«ãã®ãŸãŸã«ããã
ãContinueããã¿ã³ãã¯ãªãã¯ãããšãã€ã³ã¹ããŒã«ãããŒãžã£ã®ã€ã³ã¹ããŒã«ãå§ãŸãã
ã€ã³ã¹ããŒã«ãå®äºãããšãã€ã³ã¹ããŒã«ãããŒãžã£ãå®è¡ããããäžèšãµã€ãã«ããã°Â migw32-base ãš mingw32-gcc-g++ ã«ãã§ãã¯ãå ¥ããã°ãããšã®ããšã ã£ãã®ã§ããããããéåžžã®å·Šã¯ãªãã¯ã§ã·ã§ãŒãã«ããã¡ãã¥ãŒã衚瀺ãããã®ã§ãã¡ãã£ãšãããã£ïŒããšæãããªããªãã·ã§ã³ã¯åŸããå€æŽãå¯èœãšã®ããšã
ã¡ãã¥ãŒããŒãã [Installation] - [Apply Changes] ãã¯ãªãã¯ãããšâŠ
確èªãŠã£ã³ããŠãéããŠâŠ
ããã±ãŒãžã®ããŠã³ããŒããå§ãŸãâŠ
ãã°ãããããšã€ã³ã¹ããŒã«å®äºã®ã¡ãã»ãŒãžã衚瀺ãããã
ããã§çµããã§ã¯ãªãããã¹ã«ãC:\MinGW\binããè¿œå ããªããã°ãªããªãããã ã现ããããšã§ããããããã°ã©ããŒãºéèšåž³ãããã¯ãC\MinGW\binããšããã±ãŒãã plus ideaãããã¯ãC:MinGWbinããšã誀èšããŠãŸã£ãããŸãã³ã³ãã€ã©ãã€ã³ã¹ããŒã«ããããšãã人ãªããèŠããããããšæããã©ããŸããã®ãããã§æè¬ã®å¿µããããããæžããããšã¯ãªããã©ã
ãšããã§Windows10ã®ç°å¢å€æ°å€æŽã£ãŠãã©ããããã ã£ãã£ãïŒ
æ€çŽ¢ããããäžèšèšäºã«è©³ããæžããŠãã£ãã
ãªã«ãªã«ãã¹ã¿ãŒããã¿ã³äžã§å³ã¯ãªãã¯ããã·ã¹ãã (Y)ããéžæãšãªã
ã·ã¹ãã ç»é¢ã®å·Šã¡ãã¥ãŒãããã·ã¹ãã ã®è©³çŽ°èšå®ããéžæâŠ
ãã·ã¹ãã ã®ããããã£ããã€ã¢ãã°ããã¯ã¹ãããäžçªäžã®ãç°å¢å€æ°(N)âŠããã¿ã³ãã¯ãªãã¯âŠ
ãç°å¢å€æ°ããã€ã¢ãã°ããã¯ã¹ã衚瀺ãããã®ã§ãäžåŽã®ãã·ã¹ãã ç°å¢å€æ°(S)ããããPathããã¯ãªãã¯ããŠãç·šé(I)âŠããã¿ã³ãã¯ãªãã¯ãããšâŠ
ãããWindows10ã§ã¯ãããªã£ãŠãããã ïŒ ä»¥åã®ããŒãžã§ã³ã§ããã£ãæã«ã¯ã»ãã³ãã³ã§åºåãããŠããã ãã ã£ããã誀ã£ãŠä»ã®èšå®ãå£ããªãããã«ãšããæ¹è¯ããªïŒ
å³ã®äžçªäžã®ãæ°èŠ(N)ããã¿ã³ãã¯ãªãã¯ãããšããç°å¢å€æ°åã®ç·šéãã®äžçªäžã«ãã¹ãå ¥åã§ããããã«ãªããããã«ãC:\MinGW\binããšå ¥åããã°ããã
ããã§å®äºã
åäœã確èªããããã«ã¯ãã³ãã³ãããã³ãããéããŠããgcc âversionããšããã³ãã³ããå ¥åããã
äžèšã®ããã«ããŒãžã§ã³æ å ±ã衚瀺ãããã°OKã§ããã
ãªããgcc --helpããšå ¥åãããšãã³ãã³ããªãã·ã§ã³ã®äžèŠ§ã衚瀺ãããã
ãŸãããŠã話ã¯ãºã¬ããã©ãWindows10ã§ã¯ã³ãã³ãããã³ããèŠã€ãã«ããããã¹ã¿ãŒããã¿ã³å³ã®Cortanaãšããããšããã«ãã³ãã³ãããã³ããããšå ¥åããŠãèŠã€ãã£ããå³ã¯ãªãã¯ã§ãã¹ã¿ãŒãç»é¢ã«ãã³çããããŠãããšãããããããã
è±ç·ã€ãã§ã«ãä»åŸã³ãã³ãããã³ããã®ã¹ã¯ãªãŒã³ã·ã§ãããããã€ãèŒããäºå®ã ãã©ãèæ¯è²é»ã«æåè²çœã ãšèŠã¥ãããããçœé»å転ããŠã¿ãã
ã³ãã³ãããã³ããã®ã¿ã€ãã«ããŒã§å³ã¯ãªãã¯ããŠãããããã£(P)ããéžæãâŠ
ãæåã®è²ãã¿ããã¯ãªãã¯ããâç»é¢ã®æå(T)ããé»ã«ããâç»é¢ã®èæ¯(B)ããçœã«å€æŽããŠã¿ãã
åäœç¢ºèªã®ããããŒãžã§ã³ã衚瀺ãããç»é¢ãåæ²èŒãã©ãã§ãããïŒ ããããæåãå°ãããããããŸãå€ããæ ãããªãããªïŒ
ãšãŸãå®çªã® âHello world!â ã衚瀺ããŠã¿ããã次ã®ãããªããã¹ããã¡ã€ã«ãäœã£ãŠ âhello.câ ãšãããã¡ã€ã«åã§ä¿åããã
#include <stdio.h>
int main(void)
{
  printf("Hello world!\n");
  return 0;
}
ã³ãã³ãããã³ãããããã¡ã€ã«ãä¿åãããã©ã«ãã«ç§»åããâgcc hello.c -o helloâ ãšå ¥åããããšã©ãŒã¡ãã»ãŒãžã衚瀺ãããªããã°ã³ã³ãã€ã«å®äºã ãç¶ã㊠âhelloâ ãšå ¥åãããšã
âHello world!â ãšè¡šç€ºãããããã§ãããã§ããã
ãšãããããã§çµããã§ã¯ãªãã£ããäžèšã§èšãã°ãç§ã®ç¥èã¯ãã£ããå€ããªã£ãŠããã®ã ïŒ
åèã«ãããµã€ãã«ç§»åããªããŠãåŒãšã³ããªãŒã§å®çµããããšãå¿ãããŠãã¹ã¯ãªãŒã³ãã£ããã£ãå€ãã«æ²èŒãããããå°ãé·ããªã£ãŠããŸããŸããããåŸç·šãã«ç¶ããŸãã
ã¹ãã³ãµãŒãªã³ã¯
Â
Â