Undefined symbol: cv::imwrite when linking with Qt Creator

The problem is not in linking, but missing #include <imgcodecs.hpp> that tells the compiler the detailed definition of the function.