Results 1 to 9 of 9

Thread: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

  1. #1
    Join Date
    Jul 2013
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Exclamation error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    I was trying to write a camera program by watching an example video, when I finished writing codes , builted it then I got a messagge like at the title.

    Actually , my problem isn't it.
    Fisrt , I made a search in this forum and other sites , I find a solution , it's about the file paths but the problem is that I add the modules path but the problem doesn't solve

    about the problem:

    content of .pr
    INCLUDEPATH += D:\opencv\include
    INCLUDEPATH += D:\opencv\modules \
    +calib3d\include
    +contrib\include
    +core\include
    +features2d\include
    +flann\include
    +gpu\include
    +highgui\include
    +imgproc\include
    +legacy\include
    +ml\include
    +nonfree\include
    +objdetect\include
    +photo\include
    +stitching\include
    +superres\include
    +video\include
    +videostab\include


    LIBS += -LD:\opencv\build\x64\mingw\bin \
    -Llibopencv_calib3d246.dll
    -Llibopencv_contrib246.dll
    -Llibopencv_core246.dll
    -Llibopencv_features2d246.dll
    -Llibopencv_flann246.dll
    -Llibopencv_gpu246.dll
    -Llibopencv_highgui246.dll
    -Llibopencv_imgproc246.dll
    -Llibopencv_legacy246.dll
    -Llibopencv_ml246.dll
    -Llibopencv_nonfree246.dll
    -Llibopencv_objdetect246.dll
    -Llibopencv_photo246.dll
    -Llibopencv_stitching246.dll
    -Llibopencv_superres246.dll
    -Llibopencv_video246.dll
    -Llibopencv_videostab246.dll

    heard files on .h

    #include <QDialog>
    #include <opencv/highgui.h>
    #include <opencv/cv.h>

    when I clicked the error to find the error line, it shows me highgui.h heard file

    1#ifndef __OPENCV_OLD_HIGHGUI_H__
    2#define __OPENCV_OLD_HIGHGUI_H__
    3
    4#include "opencv2/core/core_c.h"
    5#include "opencv2/core/core.hpp"
    6#include "opencv2/highgui/highgui_c.h"
    7#include "opencv2/highgui/highgui.hpp"
    8
    9#endif

    the error line is 4

    ------------------
    I changed the path in the error line (4th) like in "core/include/opencv2/core/core_c.h" way after that time there is another error:

    error: opencv2/core/types_c.h: No such file or directory

    Now , What are your suggestions?

    Thanks for your help

    -------------------------------
    I added wrong tag in tags box sorry about that
    Last edited by studentQt; 10th September 2013 at 18:27. Reason: spelling corrections

  2. #2
    Join Date
    Nov 2007
    Posts
    55
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    just let your file finder do the job for you.
    on my computer, windows explorer found 4 locations of the file types_c.h!

    Alain

  3. #3
    Join Date
    Jul 2013
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    do u think that's the exact solution? I think not

    isn't there another suggestion ?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    Your INCLUDEPATH and LIBS continuation lines are all missing the ending backslash.

    Your INCLUDEPATH variable makes no sense anyway. What are the "+" symbols supposed to mean?

    Your LIBS variable: either list the full path to each library file OR (preferrably) use the -Lsearch_path and -lname form.
    Declaring other libraries

    Assuming your paths are generally correct then this should do it (these are for the binary install):
    Qt Code:
    1. INCLUDEPATH += D:/OpenCV/build/include
    2.  
    3. # One of these variants depending on your compiler
    4. # or an x64 version if you are building 64-bit
    5. #
    6. LIBS += -LD:/opencv/build/x86/vc8/lib
    7. LIBS += -LD:/opencv/build/x86/vc9/lib
    8. LIBS += -LD:/opencv/build/x86/vc10/lib
    9. LIBS += -LD:/opencv/build/x86/mingw/lib
    10.  
    11. # Add the libraries you actually use with -l options.
    12. LIBS += -lopencv_highgui246 \
    13. -lopencv_imgproc246 \
    14. -lopencv_objdetect246
    To copy to clipboard, switch view to plain text mode 
    The exact paths depend on how you installed OpenCV.
    At run time the relevant D:/OpenCV/build/x86/compiler/bin directory must be in the PATH for the executable to find the DLLs.

    Then in your code:
    Qt Code:
    1. #include "opencv/cv.h"
    2. #include "opencv/highgui.h"
    3.  
    4. int main(int argc, char** argv)
    5. {
    6. IplImage* img = cvLoadImage( "image.jpg" );
    7. cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
    8. cvShowImage("Example1", img);
    9. cvWaitKey(0);
    10. cvReleaseImage( &img );
    11. cvDestroyWindow( "Example1" );
    12. return 0;
    13. }
    To copy to clipboard, switch view to plain text mode 


    Added after 4 minutes:


    Quote Originally Posted by studentQt View Post
    do u think that's the exact solution? I think not
    isn't there another suggestion ?
    No, the exact solution requires you to gain a little understanding how a compiler and linker work together to find required components and build an executable, and how that executable finds the things it needs to run. That has little to do with Qt, however, that understanding quickly resolves exactly the sort of problems you are experiencing here.
    Last edited by ChrisW67; 11th September 2013 at 00:14.

  5. The following user says thank you to ChrisW67 for this useful post:

    studentQt (11th September 2013)

  6. #5
    Join Date
    Jul 2013
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    I tried to write a path for an image but qt gives errors

    the error.jpg

    do u have a suggestion about this?

  7. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    The compiler warning on line 8 is because you have an unescaped backslash in the C++ string literal and there is no escape code "\i".

    The linker errors are because your LIBS variable is still wrong.

  8. #7
    Join Date
    Jul 2013
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    my .pro file content

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2013-09-11T03:55:37
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core
    8.  
    9. QT -= gui
    10.  
    11. TARGET = camera_onConsole
    12. CONFIG += console
    13. CONFIG -= app_bundle
    14.  
    15. TEMPLATE = app
    16.  
    17. INCLUDEPATH += D:\opencv\build\include
    18.  
    19. LIBS += -LD:\opencv\build\x64\mingw\lib
    20. LIBS += -LD:\opencv\build\v9\mingw\lib
    21. LIBS += -LD:\opencv\build\v10\lib
    22. LIBS += -LD:\opencv\build\v11\mingw\lib
    23.  
    24. LIBS += -lopencv_highgui246 \
    25. -lopencv_imgproc246 \
    26. -lopencv_objdetect246
    27.  
    28. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    waiting to your suggestions
    Last edited by studentQt; 11th September 2013 at 11:03.

  9. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    Quote Originally Posted by Me
    Qt Code:
    1. # One of these variants depending on your compiler
    2. # or an x64 version if you are building 64-bit
    3. #
    4. LIBS += -LD:/opencv/build/x86/vc8/lib
    5. LIBS += -LD:/opencv/build/x86/vc9/lib
    6. LIBS += -LD:/opencv/build/x86/vc10/lib
    7. LIBS += -LD:/opencv/build/x86/mingw/lib
    To copy to clipboard, switch view to plain text mode 
    One of these variants, not all of those variants, not random variations on them etc. Above all they should actually match the compiler you are using (vc9, vc10, vc11, or mingw), the architecture you are building for (x86 or x64), and the actual location of the files on you hard drive. In your case I would guess mingw and x86.

    You will also note I am using UNIX-style path separators '/' not Windows-style '\'. This avoids the need to constantly escape the backslashes to suppress the warnings that qmake issues (I am sure you have noticed).
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  10. #9
    Join Date
    Jul 2013
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1

    thanks for all of your helps , I have just one error

    the last error.jpg

    pro_file.jpg

    now , what should I do?

Similar Threads

  1. Replies: 11
    Last Post: 1st February 2018, 04:27
  2. Replies: 3
    Last Post: 12th March 2015, 20:06
  3. error: QMimeSource: No such file or directory
    By seauniv in forum Qt Programming
    Replies: 1
    Last Post: 21st August 2013, 05:31
  4. Replies: 4
    Last Post: 9th May 2010, 16:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.