[CODE]
#include <iostream>
#include <sstream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main(){
cout << "openCV Version: " << CV_VERSION << endl;
Mat image = imread("img.jpg", IMREAD_COLOR);
namedWindow("Original Image");
imshow("Original Image", image);
return 0;
}
[ERROR]
2023-10-29 17:39:35.782532+0900 surename[4309:273575] [Window] Warning: Window CVWindow 0x108d1c010 ordered front from a non-active application and may order beneath the active application's windows.
2023-10-29 17:39:35.783451+0900 surename[4309:273862] [client] No error handler for XPC error: Connection invalid
Program ended with exit code: 0
I use opencv in these environment: M1 Mac(ver.13.4(22F66)), Xcode(Version 14.3.1 (14E300c)), C++
And i install and build opencv in this routine.
- git clone opencv & opencv_extra_modules
- brew install cmake
- cmake & make & sudo make install
And i set xcode like this.
- header search path: ".../opencv/install/include/**"
- library search path: ".../opencv/install/lib"
- other linker flags: output from "pkg-config —cflags —libs opencv4" in terminal. (install folder have cmake install things cause i have cmake option. CMAKE_INSTALL_PREFIX=.../opencv/install)
I think there are some problems related to dynamic library link... But i cannot sure about this exactly.
I tried xcode setting(RunPath Search Paths: "…/install/lib" & Signing&Capabilities-Rumtime Exception-Disable Library Validation CHECK). And add Environmanet Variable and PKG_CONFIG_PATH to my .zshrc file.
From search, i recovered this error doesn't matter to me. I just want to make cv code and check that result in xcode. So, in my case the only one to do is add those 2 code. This shows my result Window correctly.