To execute in linux system use the following command.
g++ main.cpp -o a.out -lGL -lGLU -lglut -Wno-write-strings;./a.out
To execute in windows system use the following command.
g++ main.cpp -o a.exe -lfreeglut -lopengl32 -lglu32 -Wno-write-strings
a.exe