Click here to Skip to main content
15,877,618 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have project written in cmakelists.txt using opencv. And, I want to run this project in QT in ubuntu. But there is an error;

`/home/asiye/
   38 |  #include <opencv2/xfeatures2d.hpp>
      |           ^~~~~~~~~~~Desktop/cmfd_framework/cmfd/execution.cxx:38: error: opencv2/xfeatures2d.hpp: No such file or directory`

But xfeatured2d  exist. ALso nonfree modules are installed. And, If I run make in terminal xfeature2.cpp are found but in QT It is not working? 



How can I fix the problem? 

( Opencv-4.6.0 and Opencv_contrib-4.x are installed) 


What I have tried:

I checked BUILD_opencv_xfeatures2d in Cmake-gui for OPENCV also 

Enabled OPENCV_ENABLE_NONFREE variable in Cmake-gui for OPENCV
Posted
Updated 3-Oct-22 6:34am

1 solution

Possibly because your include statement is telling the compiler to look in the standard library locations and your opencv is in your project folder. Try changing it to
C++
#include "opencv2/xfeatures2d.hpp"

with double quotes rather than angle brackets.
 
Share this answer
 
Comments
Member 11246616 3-Oct-22 12:37pm    
/home/asiye/Desktop/cmfd_framework/cmfd/execution.cxx:38: error: opencv2/xfeatures2d.hpp: No such file or directory
38 | #include "opencv2/xfeatures2d.hpp"
Richard MacCutchan 3-Oct-22 12:43pm    
Well then you need to find out exactly where that directory is, and provide the complete path in your include statement. Alternatively add the root path to the include list in your make file.
0x01AA 3-Oct-22 12:38pm    
That seems promising, 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900