Dev*_*eHQ 3 c# c++ bash windows-10 windows-subsystem-for-linux
我想运行gcc在bash同C#或C++,所以我可以做一个小的IDE它.我尝试用cmd运行gcc :( - bash gcc --versionversion只是一个例子)但它显示错误:/usr/bin/gcc: /usr/bin/gcc: Can't run the file
所以我想我需要一个特定的命令C#或C++?或者,我可以采用某种运行gcc上bash直接?
Ric*_*ner 10
您需要确保在Bash中安装了gcc,然后才能从Bash或Windows调用它.
一个简单的方法是安装 build-essential 伪包,它将引入GCC/G ++和许多其他常用的开发工具,库等:
$ sudo apt-get install build-essential
Run Code Online (Sandbox Code Playgroud)
完成此操作后,gcc --version从Bash中运行以确保它可以访问:
$ 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.
Run Code Online (Sandbox Code Playgroud)
现在你应该能够从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.
Run Code Online (Sandbox Code Playgroud)
HTH