Have gcc i.e. GNU c++ compiler ignore shebang

This error urges act on how to make GNU c++ ignore shebang:

1
2
m.cpp:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/vim 
Please do favour solve it. thanks much
Last edited on
Maybe do chmod +x m.cpp and have the first line read
//usr/bin/env vim "$0"
@abdul
I am unsure why you have this obsession with doing weird things to C++ code.

You have been advised many times to either get yourself a more powerful preprocessor or write your own program to translate between the weird C++ variants you want and C++ you can actually compile.

All the strange things you are trying to do can be fixed by doing just that.


In this case, I cannot fathom why you have a C++ source file (designed to be fed into a compiler) with a shebang directive indicating it is actually an executable file loading itself into VIM. Those are orthogonal objectives. The latter objective is just plain odd.
Last edited on
Topic archived. No new replies allowed.