0

I have installed Ubuntu subsystem in Windows 10 and I also installed gcc. I wrote a simple Hello world C program and saved it in documents. When I try to compile this program I get this answer:

Tony316@DESKTOP-2ONG1CO:~$ gcc Hello.c -o Hello
gcc: error: Hello.c: No such file or directory
gcc: fatal error: no input files compilation terminated.

I think I have to put my Hello World program in the correct file for gcc to find it, but I don't know how to compile it.

I know this question may have been asked before from users that run only ubuntu in their PC, but I am running it on Windows 10 and I couldn't find anything relevant

Zanna
  • 72,312
Tony316
  • 11

1 Answers1

3

As I understand it (this is a result of some quick research), the Bash environment in Windows has two separate "home" directories: one containing your Windows files and the other containing files such as .bashrc and other traditional home directory files found in Linux. To navigate to your Windows Document folder type: cd /mnt/c/Users/yourusername/Documents/. From there, compile your program using gcc with gcc Hello.c -o Hello.