How can I run GCC into WSL?

Viewed 1221

So, Windows System on Linux seems to be an inovative light-weight substitute for a virtual machine, especially when it comes to learning Linux. Nevertheless, for me WSL seems to have a little more complicated organization from a VM when it comes to file management. For example, in WSL the data are stored in

C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs\usr\

as shown here. Of course my first try to install GCC was to type in:

sudo apt install gcc

,but after typing

gcc --version

the output was :

Command 'gcc' not found, but can be installed with:

sudo apt install gcc

After that, I tried installing GCC using the following commands as shown here :

$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt autoremove -y
$ sudo apt-get install gcc -y

but I end up getting the same output. On the other hand, I already had installed TDM GCC on Windows and used sudo in VM to install it also there (successfully:). Like a lot of people, I want to substitute the use of my virtual machine with WSL in order to be able to develop in C without overloading my RAM my questions are :

  • Can you count out for me how many times have I downloaded GCC files?
  • Why the folder that I was supposed to be downloading the gcc files in is shown to be empty?
  • Where are the downloaded files being stored?
  • How can get gcc fired up?
  • Is there any way to use the gcc I had on Windows to compile C using the WSL terminal?

    I think these questions come from the fact that I cannot understand how WSL file system interacts with Windows. They are a bit more generic on purpose because I want you to have a lot of "answering" freedom. Please help me out of this one! I don't want to be forced to use a virtual machine and run out of RAM almost every time!
  • 0 Answers
    Related