Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux, C++, ThirdParty libs

Tags:

c++

linux

sdl

glew

Ok just a simple question. I am programming in Visual C++ on Windows and for learning purposes have changed to Ubuntu and started in Code::Blocks, CodeLite and Eclipse. I have written some simple program using SDL2 and GLEW to make a simple OpenGL application based on SDL2 windowing. I have downloaded libraries with commands:

sudo apt-get install...

My main question is: since this application is rellying on external libraries (SDL2, glew, flu, OIS), it doesn't work on other linux computers. After you install all those libraries using terminal commands then the program works otherwise will not execute. My question is, is it possible to build program that will not need to have those libraries installed. For example, on Windows you link your program to SDL2.lib and include SDL2.dll in .exe folder. How can I do that on linux. I have very little experience with linux programming and how stuff works, so I hope it's just a basic problem. :)

like image 449
Puso Avatar asked Sep 05 '16 07:09

Puso


1 Answers

In Linux the equivalent to the dll files are .so files. So you need to deliver them with you.

You can also link statically against the libraries. Those should be the ending with .a. With those they get directly compiled into your program and you don't need to deliver those.

A more advanced (Linux-like) approach:

What is usually done in Linux (as an example now Debian/Ubuntu) you create a package (in case of debian a .deb-file - debian package). In those packages you can add meta information like on what other packages it depends (those packages can be installed via apt-get).

When you then install the package manually with dpkg it will tell you dependencies are missing and you can fix those with apt-get -f install. You can also create your own apt repository and it will install your program with the dependencies with just apt-get install ...

Other linux distributions have other package management systems. This is just as an example for debian/ubuntu.

like image 147
Hayt Avatar answered Oct 13 '22 00:10

Hayt