Irrlicht engine game wont compile on linux. Undefined refrences(opengl and xfree)

I'm trying to port over my game I'm developing to Linux. But when i compile i get a lot of undefined references to mostly functions that look like they belong to OpenGL. Most are titled gl... But one of them is called XFree.

I compiled it with this command:

g++ main.cpp -L../../../LIB/irrlicht-1.8.3/lib/Linux/ -lIrrlicht -I../../../LIB/irrlicht-1.8.3/include/


one of the errors:

/home/owner/LIB/irrlicht-1.8.3/source/Irrlicht/COpenGLDriver.cpp:3746: undefined reference to glVertex3f

• should be more like: g++ ... -lGLU -lGL -lX11 – MickLH Jun 27 '16 at 21:04
• Which GNU/Linux distro are you trying to port your game to specifically? Are you sure that you have the development packages for those libraries installed? Most distros have a prepackaged version of Irrlicht that is probably a much better idea to use. – bkeys Jun 27 '16 at 21:55

You'll need to install development libraries for OpenGL and X11. You didn't state what distro you're using, but in Ubuntu OpenGL development library is in package libgl1-mesa-dev.
g++ main.cpp -w -I../../../LIB/irrlicht-1.8.3/include/ -L ../../../LIB/irrlicht-1.8.3/lib/Linux/ -lIrrlicht -lGLU -lGL -lX11 -lXxf86vm
`