您需要确保在
Bash中安装了gcc,然后才能从Bash或
Windows调用它.
一个简单的方法是安装build-essential伪包,它将引入GCC / G和许多其他常用的开发工具,库等:
$sudo apt-get install build-essential
完成此操作后,从Bash中运行gcc –version以确保它可以访问:
$gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
现在你应该能够从cmd / PowerShell / CreateProcess / Process.Create()/ etc调用gcc:
C:\> bash -c "gcc --version"
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
HTH