Is it possible to compile a stream of data rather than compiling a .c file using gcc? for example, is it possible that instead of having my code stored in any xyz.c file, I can directly compile the code?
Is it possible to compile a stream of data rather than compiling a .c
Share
Use gcc options
-xand-$ echo -e '#include <stdio.h>\nmain(){puts("Hello world");return 0;}' | gcc -xc -ogarbage - && ./garbage && rm garbage Hello worldThe single line command above is made up of the following parts:
echo -e '#include <stdio.h>\nmain(){puts("Hello world");return 0;}' # "source" | # pipe gcc -xc -ogarbage - # compile && # and ./garbage # run && # and rm garbage # delete