I used to face same problem as you do with g++
. I solved this irritating problem just now. Here is how I come to the solution, step-by-step:
On Windows, you can create an alias of g++
with all given options which you want to use with g++
. Say, for example, you want to create an alias s++
of g++ -enable-auto-import
, then you run this on cmd
as:
C:>doskey s++=g++ -enable-auto-import
This creates an alias called s++
. But this alias will not take any command line argument, which means, you cannot write this:
C:>s++ filename.cpp //it is not working
To make it work, if you've to tell the alias to accept command line arguments while creating it, so here is how it is done:
C:>doskey s++=g++ -enable-auto-import $*
Please note the $*
at the right, which indicates that now s++
can take command line argument:
C:>s++ filename.cpp //yayyyy..its working now, without giving any warnings!
But you may not prefer to create the alias everytime you open cmd
. In that case, you can create a shortcut of cmd
.
For example, I created a shortcut called Console
and in the Target
textbox of shortcut window, I wrote this:
C:WINDOWSSystem32cmd.exe /K doskey s++=g++ -enable-auto-import $*
And since this is too long (horizontally), one screenshot was not able to capture the entire command. I took two screenshots so that you could see yourself how I did it:
For more information on creating aliases on windows, see this:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…