I need to "set up the environemnt so that the location of g++ is available from the PATH? WHat does that mean? I am new to computer science hence the jargon is still a bit confusing
Asked
Active
Viewed 430 times
1 Answers
1
You are probably reading instructions for setting up GCC on Windows. While Linux does have environment variables, including the PATH variable, it's not needed to add GCC to your PATH since it will be available by default.
Simply install GCC which includes the g++ compiler:
sudo apt install build-essential
This will install GCC and other common tools for building C++ code such as make. If for some reason you want to only install GCC you can do:
sudo apt install gcc
In either case you will see that both gcc and g++ commands are available and can compile a basic hello world like this:
g++ hello.cpp
Where hello.cpp contains something like:
#include <iostream>
int main() {
std::cout << "Hello" << std::endl;
return 0;
}
Kristopher Ives
- 5,669