1- handling mouse's event , 2- downloaded library and didn't work



  • Hey,

    I wanted to ask if I could handle the mouse event which is when I point , I mean you right click and drag it " a blue thing appears " and you could select anything you want , hopefully you guys knew what I'm talking about , for example if you want to delete 5 files , you first drag the mouse to them and it'll select them all and then you could press delete. how can I handle that event ?

    my second question is:

    I'm trying to use a library called QtMel

    http://kibsoft.ru/

    I've done all what it says , I downloaded Libav & QtMultimediaKit & QtMEL and put them in a file , every one is in it's own file , then I downloaded opencv and installed it normally

    then tried to do this in my project's pro file:

    INCLUDEPATH += C:\Encoding\QtMel_Library\include
    LIBS += C:\Encoding\QtMel_Library\lib

    CONFIG(debug, debug|release) {
    LIBS += -lqtmeld1
    } else {
    LIBS += -lqtmel1
    }
    and when I tried to include the Recorder header , when I write Rec only it shows that there's a header called recorder but when I include it and then compile my program it says:

    error: C1083: Cannot open include file: 'Recorder': No such file or directory



    1. You are talking about controlling a selection. The QAbstractItemView and QGraphicsView descendants provide support for selections on their underlying model/scene. Your example of selecting 5 files to delete would be based on selecting from a list, tree or table view.

    2. The INCLUDEPATH is wrong, the file exists but is not readable, or you have not run qmake since modifying the PRO file so the new include path options are not being given to the compiler etc.

    Once you resolve your INCLUDEPATH Issue, your LIBS value is incorrect and will cause linking issue (you are not getting that far yet). It should include "-L" and read (per the QtMEL page):
    @
    INCLUDEPATH += C:/Encoding/QtMel_Library/include
    LIBS += -LC:/Encoding/QtMel_Library/lib

    CONFIG(debug, debug|release) {
    LIBS += -lqtmeld1
    } else {
    LIBS += -lqtmel1
    }
    @
    Notice that I have used forward slashes in paths to avoid easy-to-make backslash escaping errors.



  • Thanks , I'll check the classes that you've said in the first question hopefully it'll help

    about the second question I think I'll use opencv alone and I used this:

    INCLUDEPATH += C:/Users/myuser/Downloads/Programs/opencv/build/include
    CONFIG(release,debug|release){
    LIBS +=-LC:/Users/myuser/Downloads/Programs/opencv/build/x86/vc11/staticlib

    }

    when I include:

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

    it works fine and all without any error but when I actually try to use things like Mat it doesn't work , for example here's what I did:

    @private:
    Ui::MainWindow *ui;
    VideoCapture cap;@

    the errors:

    @
    error: C2146: syntax error : missing ';' before identifier 'cap'

    error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    error: C2146: syntax error : missing ';' before identifier 'cap'

    error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    error: C2146: syntax error : missing ';' before identifier 'cap'

    error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    @



  • Oh right , I must use the namespace cv :)

    anyways there are new problems :D

    whenever I use a variable lets say Mat this happens:
    @
    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YAHPAHH@Z) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)

    debug\CaptureTools.exe:-1: error: LNK1120: 3 unresolved externals

    @

    I tried to clean it and run qmake then rebuild but the same problems happens.



  • Linker errors => LIBS is wrong, you have not told qmake which OpenCV libraries you want linked (-l options), just where to find them (-L options).



  • Sorry didn't understand what you've said :(

    I followed your comment before but still it's not working:
    @
    INCLUDEPATH += C:/Users/myuser/Downloads/Programs/opencv/build/include/
    LIBS +=-LC:/Users/myuser/Downloads/Programs/opencv/build/x86/vc11/staticlib/@

    should I copy every name of the libs and replace -L with -l ? can I just include the whole file ? how ?



  • I downloaded a new version , and found two folders one for the source and I assumed it's for those who wants to build one , and the build folder which is the one that I used , put this in my pro file:
    @
    INCLUDEPATH += C:/opencv/build/include
    LIBS +=-LC:/opencv/build/x86/vc11/staticlib
    CONFIG(debug, debug|release){
    LIBS +=-lopencv_core249
    LIBS +=-lopencv_core249d
    LIBS +=-lopencv_highgui249
    LIBS +=-lopencv_highgui249d\

    }@

    and found this error:
    @
    :-1: error: LNK1104: cannot open file '+=-lopencv_core249d.obj'
    @


  • Lifetime Qt Champion

    Hi,

    @
    LIBS +=-lopencv_core249
    LIBS +=-lopencv_core249d
    LIBS +=-lopencv_highgui249
    LIBS +=-lopencv_highgui249d
    @

    Should be

    @
    CONFIG(debug, debug|release){
    LIBS +=
    -lopencv_core249d
    -lopencv_highgui249d
    }

    CONFIG(release, debug|release){
    LIBS +=
    -lopencv_core249
    -lopencv_highgui249d
    @

    Using a backslashe after every line just concatenates them



  • Thanks , I'll restart my computer then try your solution , hopefully it'll work.



  • Well it didn't work :(

    now it shows about 211 errors along with the ones before , can I just compile my own opencv ? I've been following a lot of tutorials on how to do so but I have no luck completing it , always shows an error in the cmake gui :(



  • Well , I still have the same problem maybe a little more :(

    I've tried in the pro file:

    @

    INCLUDEPATH += C:/opencv249/build/include
    LIBS +=-LC:/opencv249/build/x64/vc12/staticlib
    CONFIG(debug,debug|release){
    LIBS+=
    -lopencv_core249d
    -lopencv_highgui249d
    }
    CONFIG(debug,debug|release){
    LIBS+=
    -lopencv_core249
    -lopencv_highgui249
    }

    @

    included:

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

    wrote this code " an example "

    @

    IplImage*img=cvLoadImage("C:\Users\myuser\QT\build-CaptureTools-Unnamed-Debug\Fri May 2 2014_3039.png");
    cvNamedWindow("example",CV_WINDOW_AUTOSIZE);
    cvShowImage("example",img);
    cvWaitKey(0);
    cvReleaseImage(&img);
    cvDestroyWindow("example");
    @

    these errors happens:

    @

    C:\opencv249\build\include\opencv2\flann\logger.h:66: warning: C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    C:\opencv249\build\include\opencv2\flann\logger.h:66: warning: C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    C:\opencv249\build\include\opencv2\flann\logger.h:66: warning: C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvReleaseImage referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvNamedWindow referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvShowImage referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvDestroyWindow referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvLoadImage referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol _cvWaitKey referenced in function "public: void __thiscall MainWindow::showimage1(void)" (?showimage1@MainWindow@@QAEXXZ)

    debug\CaptureTools.exe:-1: error: LNK1120: 6 unresolved externals

    @



  • Well new problem after following a solution from a guy in qt center website:
    when using debug mode:
    :-1: error: LNK1104: cannot open file 'opencv_core246d.lib'

    when using release mode:
    :-1: error: LNK1104: cannot open file 'opencv_core246.lib'


  • Lifetime Qt Champion

    What version of Qt did you install and what compiler are you using ?

    The last problem is a typo ? You have OpenCV 2.4.9 and you have linked to the 2.4.6 library



  • I'm using Qt 5.1.1 I built it statically , the compiler is msvc11 x86

    Yeah , I fixed the last problem ,I even downloaded another version but still the same problem..



  • for anyone with the same problem:

    http://www.qtcentre.org/threads/58975-Couldn-t-link-opencv-with-qt-creator-this-error-happens?p=262379#post262379

    I followed what he said and I think it's working now " need to test it more " but at least it compiled without errors"


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.