I want to run gcc
on bash
with C#
or C++
so I can make a little IDE for it. I tried to run gcc with cmd: bash gcc --version
(--version is just a example) but it shows the error: /usr/bin/gcc: /usr/bin/gcc: Can't run the file
So i guess i need a specific command in C#
or C++
? Or can i somehow run gcc
on bash
directly?
You need to ensure you've got gcc installed in Bash before you can invoke it from Bash or from Windows.
An easy way to do this is to install build-essential
pseudo-package which will bring in GCC/G++ and a host of other commonly required dev tools, libs, etc:
$ sudo apt-get install build-essential
Once you've done this, run gcc --version
from within Bash to make sure it's reachable:
$ 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.
Now you should be able to invoke gcc from cmd/PowerShell/CreateProcess/Process.Create()/etc:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With