C/C++/OpenCVの知識はそんなにないです。
msys2にてpacmanでclang++、make、openCV、その他依存パッケージもろもろをインストールしました。
以下のようなソースコードを書いて
// test.cpp
#include <opencv2/highgui.hpp>
using namespace cv;
int main()
{
Mat img = imread("image.png", 1);
imshow("image", img);
waitKey();
return 0;
}
#Makefile
INC = -I "C:\msys64\mingw64\include\opencv4"
DIR = -L "C:\msys64\mingw64\bin"
FLAGS = -lopencv_core401 -lopencv_highgui401
main:
clang++ $(INC) $(DIR) test.cpp $(FLAGS)
PS C:\Users\(ユーザー名)\Documents\source> make
clang++ -I "C:\msys64\mingw64\include\opencv4" -L "C:\msys64\mingw64\bin" test.cpp -lopencv_core -lopencv_highgui
C:\Users\Hiiragi\AppData\Local\Temp\test-2b4b06.o:(.text+0x57): undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:7: main] Error 1
他のサイトも調べましたが、よく分からないor試しても解決しませんでした。
分かる方がいたら助けをお願いします。
PS C:\Users\(ユーザー名)\Documents\source> clang++ -v
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:\msys64\mingw64\bin
PS C:\Users\(ユーザー名)\Documents\source> make -v
GNU Make 4.2.1
Built for x86_64-pc-msys
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.