T
T
Tesla4o2020-02-25 15:04:02
C++ / C#
Tesla4o, 2020-02-25 15:04:02

How to determine Ubuntu version in code?

There is code for libv8-dev that works on ubuntu 18. But on 19.10 it no longer works because the version of the libv8-dev library is different on it. Therefore, I had to rewrite the code for a new one. But since you need to do something that would work on both versions, I think that it's easy to write in one file for both versions. And separate the code with the #ifdef switch. I just can’t find anywhere by what define to do code switching depending on the version of Ubuntu.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-02-25
@Tesla4o

The standard solution is to use autoconf
It is able to determine the libraries in the system and assign the necessary defines
https://www.gnu.org/software/autoconf/manual/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question