Tuesday, June 06, 2023

Ubuntu 18 OpenGL compilation issues

1) 

In file included from main.cpp:8:0:
gluvi.h:10:10: fatal error: GL/glut.h: No such file or directory
#include <GL/glut.h> // ...when everyone else puts it here?
         ^~~~~~~~~~~

$ sudo apt-get install freeglut3-dev

2)

util.h: In function ‘double randhashd(unsigned int)’:
util.h:259:33: error: UINT_MAX’ was not declared in this scope
{ return randhash(seed)/(double)UINT_MAX; }

#include <climits>

3)

array1.h: In constructor ‘Array1<T>::Array1(long unsigned int, const T*, long unsigned int)’:
array1.h:124:12: error: memcpy’ is not a member of ‘std
      std::memcpy(data, data_, n*sizeof(T));

#include <cstring>


4) Does not find/recognize libGL

fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ g++ testgl.cpp -lglut -lGLU -L/usr/lib -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status

#Check symbolic link

$ file /usr/lib/x86_64-linux-gnu/libGL.so 
/usr/lib/x86_64-linux-gnu/libGL.so: broken symbolic link to libGL.so.1.0.0 
 
$ file /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0 #this is right file
/usr/lib/x86_64-linux-gnu/libGL.so.1.7.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

#Update libGL link, first go to directory and update

$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s libGL.so.1.7.0 libGL.so

#back to source directory and try again

fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ g++ testgl.cpp -lglut -lGLU -lGL            
fincahuanaco@pisces:~/DRIVE/Research23/viscosity$ ./a.out

References:

[1] First OpenGL code http://www.codebind.com/linux-tutorials/install-opengl-ubuntu-linux/




No comments:

Running apps

Runtastic (I uninstalled because force to update your device - Internet connection problems) Runkeeper  (Currently testing) Strava   (Curre...