Turn your C++/Java/whatever source into executable

Revision en1, by CountZero, 2018-02-06 20:41:41

borrowed from https://gist.github.com/jdarpinian/1952a58b823222627cc1a8b83a7aa4e2

This trick is for linux/mac/wsl. Just add one comment to the top of your source file

C++

run chmod +x test.cpp and that's it, you can use it as an executable:

$ ./test.cpp
hello world

you can do this with java too:

Java

Enjoy!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English CountZero 2018-02-06 20:41:41 812 Initial revision for English translation
ru1 Russian CountZero 2018-02-06 20:36:26 811 Первая редакция (опубликовано)