Can't figure out how to install a C++ library (GLUI) on linux Mint

223 views Asked by At

I have been trying forever to install this: https://github.com/libglui/glui on my Linux mint distribution. I usually install stuff with the command line, and am a novice at manually installing libraries. Basically, I download the Github repo, ran the make file, and was not sure where to go from there. They don't really provide any instructions that I can find.

Basically I ran make and it generated a .a file. I moved this .a file into my /usr/lib/x86_64-linux-gnu folder. Now when I run this:

g++ -o test test.cpp /usr/lib/x86_64-linux-gnu/libOpenCL.so -lGL -lGLU -lglut -lglui -lm -fopenmp

instead of getting my previous error (/usr/bin/ld cannot find -lgui) I get this wall of doom:

/usr/bin/ld: /tmp/ccvdD4zb.o: in function `InitGlui()':
sample.cpp:(.text+0x10d4): undefined reference to `GLUI_Master_Object::create_glui(char*, long, int, int)'
/usr/bin/ld: sample.cpp:(.text+0x10f4): undefined reference to `GLUI::add_statictext(char*)'
/usr/bin/ld: sample.cpp:(.text+0x112b): undefined reference to `GLUI::add_checkbox(char*, int*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x1153): undefined reference to `GLUI::add_checkbox(char*, int*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x117b): undefined reference to `GLUI::add_checkbox(char*, int*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x1196): undefined reference to `GLUI::add_panel(char*, int)'
/usr/bin/ld: sample.cpp:(.text+0x11c7): undefined reference to `GLUI::add_rotation_to_panel(GLUI_Panel*, char*, float*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x122c): undefined reference to `GLUI::add_translation_to_panel(GLUI_Panel*, char*, int, float*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x1295): undefined reference to `GLUI::add_translation_to_panel(GLUI_Panel*, char*, int, float*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x12fe): undefined reference to `GLUI::add_translation_to_panel(GLUI_Panel*, char*, int, float*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x1335): undefined reference to `GLUI::add_panel(char*, int)'
/usr/bin/ld: sample.cpp:(.text+0x135f): undefined reference to `GLUI::add_button_to_panel(GLUI_Panel*, char*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x13a0): undefined reference to `GLUI::add_button_to_panel(GLUI_Panel*, char*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x13e1): undefined reference to `GLUI::add_button_to_panel(GLUI_Panel*, char*, int, void (*)(int))'
/usr/bin/ld: sample.cpp:(.text+0x1422): undefined reference to `GLUI::add_button_to_panel(GLUI_Panel*, char*, int, void (*)(int))'
collect2: error: ld returned 1 exit status

Obviously I need to do something else with that repo I downloaded and ran the make file for, I just have no idea what and can't seem to find an answer anywhere, please help!

1

There are 1 answers

0
Botje On

If you look at the project history, commit 936b3d7e6a42c6eab0eecc191861b0a98fa7fc30 (30 Jun 2017) replaced all the mentioned functions with functions that take a const GLUI_String&.

You have apparently picked up a glui.h file somewhere that references the old interface. You should instead copy the glui.h file from the repo to /usr/local/include/GL/glui.h and add -I/usr/local/include to your compile flags. That will make sure the header matching the library is selected and you do not get these errors.