The following command causes an exception.
cv::imwrite(\"test.jpg\", diffImg);
I also tried numerous variations on this, including absolute
I run into the same runtime error "opencv error unspecified error (could not find a writer for the specified extension)". I used the same solution as Pieter, that is in the project setting-->linker-->Input-->Aditional Dependencies, I specified to use the debug version of the opencv libs for MSVS debug cofiguration, and specify to use the release version of the opencv libs for MSVS release configuration. Then the runtime error is gone.