3 ms·
Ask HN: Have GNU C++ compiler ignore shebang
Any Guru of C++ so solve this error below making GNU c++ ignore shebang?
m.cpp:1:2: error: invalid preprocessing directive #!
1 | #!/usr/bin/vim
Please do favor solve it, thanks so much
- coreyp_1 4y agoI don't think that this is possible. The `#` is not a valid comment in C++, and `#!` is not a valid preprocessor directive, hence the error.
- gsteele178 4y ago#include¡ //user/bin/vim
- gsteele178 4y agoTry{ #include!/user/bin/vim Return!O
- kazinator 4y agoThere is no way to solve this so that you have a single file X.cc that you can feed to g++ as an argument: g++ X.cc ... and such that this file is a hash bang script. C and C++ can be hash-bang scripted, through a shell script which cuts out the incompatible material and feeds the rest to the compiler. See the solution for the multiline shebang task in Rosetta Code: https://rosettacode.org/wiki/Multiline_shebang#C https://rosettacode.org/wiki/Multiline_shebang#C I'm guess you're trying to make the program self-editing rather than self executing, by using Vim as the interpreter?