After successfully compiling helloworld, I will program OpenCV
But something strange happened
When my cpp file is still the original helloworld
I can compile arm programs separately
Or compiling the opencv program separately can also be compiled normally
When I enable both arm cross-compilation and opencv in cmakelists.txt, the error is as follows
/usr/local/lib/libopencv_highgui.so.4.8.0: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
CMakeFiles/Test2.dir/build.make:109: recipe for target 'Test2' failed
make[2]: *** [Test2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test2.dir/all' failed
make[1]: *** [CMakeFiles/Test2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
When I compile a normal opencv program cmake enables opencv and does not enable cross-compilation, he can also compile
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include<iostream>
#include <string>
#include <sstream>
using namespace cv;
using namespace std;
int main()
{
// Capture the Image from the webcam
VideoCapture cap(0);
// Get the frame
Mat save_img; cap >> save_img;
if(save_img.empty())
{
std::cerr << "Something is wrong with the webcam, could not get frame." << std::endl;
}
// Save the frame into a file
imwrite("test.jpg", save_img); // A JPG FILE IS BEING SAVED
}