Just recently I installed Ubuntu and with it: Eclipse Version: Luna Service Release 2 (4.4.2) Build id: 20150219-0600
. I've installed the MinGW GCC compiler via the command line option Ubuntu provides for my 64-bit system.
sudo apt-get install mingw-w64
When I made my project, Eclipse started to whine. It kept saying Toolchain "MinGW GCC" is not detected.
It, however, does still find errors in my code. No errors are produced about it not being able to find the path of g++ or gcc, though. So I was searching Google and many sources said I would need to set the PATH variable of my installation. However I cannot find the installation path of MinGW-w64. How can I find what this path should be in Ubuntu 14.04 and set the path variable that needs to be set.
Additioanl information:
-At the end of this path Window->Preferences->C/C++->Build->Settings->Discovery->CDT GCC Built-in Compiler Settings
has the command to get compiler specs as ${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"
-At the end of this path Window->Preferences->C/C++->Build->Environment
has no Environment variables set at all, including the PATH
variable.
-Under the following Project Properties->C/C++ Build
both check marks are chosen.
->Build Variables
is empty.
->Environment
has the value of MINGW_HOME
as /usr
. The value of MSYS_HOME
is blank. The value of PATH
is ${MINGW_HOME}/bin:${MSYS_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
.
->Tool Chain Editor
has the check mark set to display compatible toolchains only, yet it seems to not have any effect on the which toolchain I can select in the following drop down menu. My current toolchain is set to MinGW GCC
and my current builder is set to Gnu Make Builder
So again, my question is what gives? Why can't eclipse see the complier that I installed to my copy of Ubuntu? And how can I not only set my PATH
variable, but I also must need to know what to set it to because I don't know where the terminal installed the /bin directory of mingw-w64
?
First you need to understand mingw is a win32 port of the original GNU compiler. So, if you're already in Linux, you preferably will use this latter.
Now, you need to figure out if your system's shell recognizes it, so try tab autocompletion in the shell, wether its mingw or gcc, open up a terminal and type
min
and then hit Tab.In case Tab autocompletion worked and you want to know where the command is located, you can use
whereis [comand]
and shell will return the path from where its running.If nothing happens, then it's not in your PATH.
PATH is defined primarily in three configuration files: local PATH is in
~/.bashrc
and~/.bash_profile
, and system PATH is defined in/etc/environment
and/etc/profile
but normally you wouldn't need to mess up with there two.To find or locate anything in your system you can use
find
.Normally, in every linux system, all binaries you install end up in
/usr/bin, /bin, /usr/local/bin
or sometimes in/opt
but that one is reserved in case its a third party vendor.At this point you can do a search like
find /usr/bin -name mingw
taking the first argument as the path to search within OR you could search directly into your environment variables withenv
.If you need to add something to the path I recommend you to create a symbolic link of your binary(no matter where its located) in
/usr/bin
and then, add that link to your local PATH, that is to say, something like this:Normally after installing gcc eclipse should automatically detect it, but if not, you can set
MINGW_HOME
with the same code as above, just omit the symbolic link step and set the variable first as follows:I hope this explanation will help you, if not, feel free to share your thoughts.