2

I'm new to xv6 OS,I wanted to run a C program in xv6, is there a command or something in it to compile and run a C program?

HanSol
  • 51
  • 1
  • 10
  • 2
    Welcomes to SO , please follow [how-to-ask](http://stackoverflow.com/help/how-to-ask) and [tour](http://stackoverflow.com/tour),it will be easy to get your solutions – Willie Cheng Jan 15 '16 at 08:30
  • does it have terminal? –  Jan 15 '16 at 09:08
  • if it has test `gcc` in terminal and tell us what it outputs –  Jan 15 '16 at 09:08
  • 4
    It's probably easier to compile programs as part of the system instead of compiling them from within the system. Add a .c file to implement the new command and add the new command with an underscore to `UPROGS` in the `Makefile`. – Ian Abbott Jan 15 '16 at 11:05
  • Thank you, Ian Abbott It was really helpful – HanSol Jan 15 '16 at 16:46

2 Answers2

0

Xv6 is a simple Unix-like teaching operating system

open the terminal and to compile

gcc program-source-code.c -o executable-file-name

and execute

./ executable-file-name
Nikhil
  • 650
  • 1
  • 11
  • 28
0

I think it is not possible to compile using gcc and put directly ur code into xv6, You have to write file like stressfs.c cat.c of xv6 source code within the xv6 source code and then add your file in the Makefile of the xv6 then you can run ur code into xv6 shell. I tried gcc but it didn't work for me