Link OpenCV projects in OSX using gcc

After getting the OpenCV using mac port I ran into trouble linking projects using the OpenCV functionalities. Using linux, it is as easy as setting the “-lcv” linker flag. Using OSX, I was only successfull when the library paths are returned by the pkg-config utility. You can run the command without the back ticks, and copy its outputs in your makefile, or just copy the command with the back ticks inside your makefile:


pkg-config --libs --cflags opencv

Leave a comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.