Skip to content

How do you link to a specific version of a shared library in GCC

I’m compiling some code which uses libcurl on a Debian Linux system. My dev machine is running Debian 5 but I want the binary to be usable on older Debian 4 systems too.

I find that if I specify -lcurl it will link to but Debian 4 systems only have

Is there some way I can tell GCC to link to either (which exists in both Debian 4 and 5) or just so it will use whatever version is available ?



You can pass the actual .so file instead of -l on the linker command line, and it ought to do what you want.

User contributions licensed under: CC BY-SA
1 People found this is helpful