I'm using windows 10 ming g++ compiler. When I was using macOS for compile and run at the same time I use the command.
g++ name.cpp && ./a.out
It worked but when I tried to use this in windows
g++ name.cpp && ./exe
it didn't work it shows an error message (The token '&&' is not a valid statement separator in this version).
So i use g++ name.cpp
./a.exe
but i want to run in a single line command.
This is actually a feature of the shell you're using to run the command(s). On MacOS it was most likely bash or zsh, while on Windows the default choice is probably cmd or PowerShell. The latter does not support &&
in a way similar to bash. Try changing the shell (terminal) in VS code settings using eg the doc page
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.