'Explaining "g++ not found in PATH" for an idiot
So, I just installed Eclipse for C/C++ and whenever I make a new project, I get two errors saying that the programs g++ and gcc are not in my PATH. All of the answers I have found so far have talked about directories, and opening up my path and changing code in there. I don't know anything about directories or paths, so I don't know what any of these answers mean. Can someone offer me a simple, easy to understand answer that walks me through what I need to do?
P.S. I have installed MinGW onto my computer, but when I create a new project, it doesn't come up as an option for which toolchain to use. The only options I get are Cross GCC and Microsoft Visual C++. When I choose the former, it asks for the cross compiler prefix and the cross compiler path, and I don't know what those mean, either. When I choose the latter, I still get the errors anyway.
P.P.S. Thanks in advance to anyone who can give me an answer that both helps and is easy to understand for someone like me.
Solution 1:[1]
If gcc
and g++
are not in your Path environment, then just add them. Here is how to do so:
1.) Go to where you have the executable for gcc/g++
2.) Click a little to the right of the file directories(When you do, it should change to be the text version of the directories.
3.) Copy the directory
4.) Go to the start menu.
5.) type in "environment variables"
6.) click on "Edit system environment variables"
7.) Go to the "Advanced" tab
8.) Click on "Environment variables"
9.) Under "system variables" find Path and select it
9.5.) If you don't have a Path variable, click new and name it Path
10.) Go to the end of the variable value (press 'end')
11.) If there is not a semicolon(';') there, put one there.
12.) Paste(Ctrl + v) the directory of your gcc/g++ executables at the end of the line
13.) now put \nameOfExecutable(gcc).exe at the end of it, and add a semicolon(';').
14.) paste again and put \nameOfExecutable(g++).exe at the end of it, and add a semicolon
15.) Then click ok, then ok, then ok. Now you should be able to use gcc/g++ in the CommandPrompt, which I think is what you need.
P.S.: In linux, it is as easy as sudo apt-get install gcc
xD
Hope this helps!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cody Richardson |