Reputation: 518
My problem is the same as in: OpenCV GTK+2.x error
I am facing this problem deploying my code in systems where OpenCV is available but has not been installed with GTK support. I have no control over OpenCV installation in these systems.
How can I discriminate where OpenCV is compiled without GTK support from C++ code, possibly without relying on catching exceptions? I would simply avoid calling imshow in these cases.
Upvotes: 2
Views: 336
Reputation: 2357
you could check dependencies by executing ldd opencv-lib
and parse the output using e.g. regex to check for some kind of gtk libs.
Or use this approach: linux/gcc: ldd functionality from inside a C/C++ program
setenv("LD_TRACE_LOADED_OBJECTS", "1", 1);
FILE *ldd = popen("/lib/libz.so");
Upvotes: 2