1

I use cross compiling for C++ using MinGW... I use

/usr/bin/i586-mingw32msvc-g++ filename.cpp

to compile, but I want to be able to type

gww filename.cpp

I think I need to set a PATH variable or something?

Note

Please note I am quite inexperienced with Linux, but can get around easily with the terminal and stuff. If this is very basic, tell me how to do it.. Note that this is a very hard search engine hit (set /usr/bin/i586-mingw32msvc-g++?), sick!

1 Answers1

0

You don't need to change your $PATH since /usr/bin is already in your path. You could actually run the command as

i586-mingw32msvc-g++ filename.cpp

That's not very pretty though, so instead, do one of

1. Make an alias for the command.

Open ~/.bashrc and add this line:

alias gww='/usr/bin/i586-mingw32msvc-g++'

Now, open a new terminal so that .bashrc is re-read (or source it manually with source ~/.bashrc) and you will be able to use gww as the command's name.

2. Make a link to it in /usr/bin.

You can create a symlink to the compiler and name the symlink gww:

cd /usr/bin
sudo ln -s i586-mingw32msvc-g++ gww

Both approaches will let you invoke i586-mingw32msvc-g++ by running gww. You can use the one you prefer. The main difference is that the 1st approach will make it available to your user only, while the second will be system-wide.

terdon
  • 104,119