I'd like to link the 'OpenCV' library with a 'Premake5'.
Since installing 'libopencv-dev' as 'apt install' on Ubuntu 18.04.
I have written and executed a simple C++ program, but it does not work.
How do I link the library? Help me...
[Here My CPP ... ]
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
int main()
{
cvNameWindow("Output", 1);
cv::Mat output = cv::Mat::zeros(120,350,CV8UC3);
putText(output, "Hello World", cvPoint(15, 70), CV_FONT_HERSHEY_PLAIN, 3, cvScalar(0,255,0), 4);
cv::imshow("Output", output);
cv::waitKey(0);
return 0;
}
[And this my premake5.lua script]
workspace "HelloPremake"
configurations {"Debug", "Release"}
location "build"
project "HelloWorld"
kind "WindowedApp"
language "C++"
configuration "gmake"
libdirs {os.findlib("libopencv-dev")}
files {"**.h", "**.cpp"}
filter { "configurations:Debug" }
defines { "DEBUG" }
symbols "On"
filter { "configurations:Release" }
defines { "NDEBUG" }
symbols "On"
Put the main.cpp and preMake5.lua in the same folder and run './premake5 gmake'.
Then build through 'cd build && make', but you cannot link OpenCV properly.
i fixed this.
[The cpp code must be:]
[The premake5.lua code must be:]