0
\$\begingroup\$

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
\$\endgroup\$
2
  • \$\begingroup\$ should be more like: g++ ... -lGLU -lGL -lX11 \$\endgroup\$ – MickLH Jun 27 '16 at 21:04
  • \$\begingroup\$ 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. \$\endgroup\$ – bkeys Jun 27 '16 at 21:55
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ I tried it on ubuntu and Debian(laptop). which are pretty similar. But thank you ill try that. \$\endgroup\$ – GameHog Jun 28 '16 at 20:04
0
\$\begingroup\$

For future people running into my problem i found the solution. I was able to compile my project with this.

-w is for removing warning its optional. I also found you need to link with -lXxf86vm

g++ main.cpp -w -I../../../LIB/irrlicht-1.8.3/include/ -L ../../../LIB/irrlicht-1.8.3/lib/Linux/ -lIrrlicht -lGLU -lGL -lX11 -lXxf86vm
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.