在Windows 10上使用c#或c++在Bash上运行GCC
Run GCC on Bash on Windows 10 with C# or C++
我想用C#
或C++
在bash
上运行gcc
,所以我可以为它做一点IDE。我试图运行gcc与cmd: bash gcc --version
(——版本只是一个例子),但它显示了错误:/usr/bin/gcc: /usr/bin/gcc: Can't run the file
所以我想我需要一个特定的命令在C#
或C++
?或者我可以直接在bash
上运行gcc
吗?
您需要确保在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
我建议在您的系统上安装Cygwin
bash
shell是Cygwin
支持的众多shell之一
相关文章:
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 奇怪的结构&GCC&clang(void*返回类型)
- GCC本机矩阵运算库
- PowerPC ppc64le上的Gcc Woverloaded虚拟错误
- gcc和c++17的过载解析失败
- 数据成员SFINAE的C++17测试:gcc vs clang
- GCC对可能有效的代码抛出init list生存期警告
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 为什么与常规GCC不同,即使有"学究性错误",MinGW-GCC也能容忍丢失的返回类型
- 使用gcc从静态链接的文件中查找可选符号
- 普通环路未使用gcc 4.8.5自动矢量化
- 有了gcc,是否可以链接库,但前提是它存在
- 在clang++预处理器中确定gcc工具链版本
- 为什么 gcc 编译这个而 msvc 没有
- 为什么lambda在clang上崩溃而不是在gcc上崩溃
- 我可以检测和更改 gcc/g++ 中结构的当前数据对齐设置吗?
- gcc和clang在表达式是否为常量求值的问题上存在分歧
- 如何使用Clang/GCC在Mac上为C/C++设置VSCode
- 一位朋友将模板函数缩写为clang和gcc