Installed open GL on ubuntu 16.04. where is the program

Asked by tusar

Installed open GL on ubuntu 16.04 by this command

sudo apt-get install freeglut3 freeglut3-dev

I get the following answer on the terminal

Reading package lists... Done
Building dependency tree
Reading state information... Done
freeglut3 is already the newest version (2.8.1-2).
freeglut3-dev is already the newest version (2.8.1-2).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

Then I gave the following command.

sudo apt-get install binutils-gold

I get the following following answer on the terminal

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'binutils' instead of 'binutils-gold'
binutils is already the newest version (2.26.1-1ubuntu1~16.04.3).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

Where are the executables and include files. when I run a test program, I get errors implying that executables do not exist.

Please help me

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu freeglut Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the test program?
Do 3D games run OK (Super Tuxcart is one example)

Revision history for this message
tusar (user007) said :
#2

The test program is below

#include <GL/glut.h>

//Drawing funciton
void draw(void)
{
  //Background color
  glClearColor(0,1,0,1);
  glClear(GL_COLOR_BUFFER_BIT );
  //Draw order
  glFlush();
}

//Main program
int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  //Simple buffer
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
  glutInitWindowPosition(50,25);
  glutInitWindowSize(500,250);
  glutCreateWindow("Green window");
  //Call to the drawing function
  glutDisplayFunc(draw);
  glutMainLoop();
  return 0;
}

When I try to compile the abv program , I get the following msg:
gcc testG.c
/tmp/ccQ9Iq5n.o: In function `draw':
testG.c:(.text+0x2b): undefined reference to `glClearColor'
testG.c:(.text+0x3b): undefined reference to `glClear'
testG.c:(.text+0x43): undefined reference to `glFlush'
/tmp/ccQ9Iq5n.o: In function `main':
testG.c:(.text+0x65): undefined reference to `glutInit'
testG.c:(.text+0x72): undefined reference to `glutInitDisplayMode'
testG.c:(.text+0x81): undefined reference to `glutInitWindowPosition'
testG.c:(.text+0x96): undefined reference to `glutInitWindowSize'
testG.c:(.text+0xa6): undefined reference to `glutCreateWindow'
testG.c:(.text+0xb6): undefined reference to `glutDisplayFunc'
testG.c:(.text+0xbe): undefined reference to `glutMainLoop'
collect2: error: ld returned 1 exit status

I assume that the OpenGL programs are not correctly installed.

Please help me.

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Does a command like

gcc testG.c -lGL -lglut

produce the same error messages, or something different?

Revision history for this message
tusar (user007) said :
#4

Does a command like

gcc testG.c -lGL -lglut

This command works with no errors.

Thank you for the help.

My question is where is ligglut and libGL.

When I search for them I get the following:

tkn@tkn-ET1810:~/Desktop/test$ whereis libglut
libglut:
tkn@tkn-ET1810:~/Desktop/test$ whereis ligGL
ligGL:
tkn@tkn-ET1810:~/Desktop/test$

I require these libraries in the /usr/lib folder to install another program.

Thanks for your help.

Tusar

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

It seems that you are not aware of the directory structure for shared libraries.

Depending on your architecture the libglut and libGL files are in
/usr/lib/x86_64-linux-gnu/
or
/usr/lib/i386-linux-gnu/

Instead of copying them to /usr/lib you should add the correct compiler and linker options (like -lGL -lglut).

And by the way, the libglut and libGL files are not executables, but shared libraries. So you cannot expect to find them with the whereis command which is a command to search for executables and man pages.

Can you help with this problem?

Provide an answer of your own, or ask tusar for more information if necessary.

To post a message you must log in.