Yes, you can.

If the amount of dependencies is high I would consider to dlopen the library rather than linking to it; since a high number of direct dependencies makes you vulnerable to incompatibilities versions between those libraries.