linker problem with opencv and devcpp
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: linker problem with opencv and devcpp

  1. #1
    Join Date
    Jan 2012
    Posts
    0

    linker problem with opencv and devcpp

    A little description about my environment: DevCpp 4.9.9.2 with OpenCV 2.3.1 on Windows Vista Home Premium SP1 32-bit

    About my project - my project's .dev (FirstCVproj.dev) file is in c:...\Desktop\proj\openCV\ and the program i'm trying to compile "facedetect.cpp" is in c:\opencv\samples\c

    The OpenCV compiler configuration in the tools->compilers in DevCpp is:

    Compiler commands

    -L"C:\opencv\build\x86\mingw\lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231
    Linker commands

    -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231
    Libraries directory: opencv\build\x86\mingw\lib

    Binaries directory: opencv\build\x86\mingw\bin

    Include directories: all the include folders in opencv folder (under the \build and the main folder)

    So before I decided to post here, i was having the problems stated here and in that order:

    libgcc_s_dw2_1.dll not found. Try reinstalling the application

    Program can't find libgcc_s_dw2-1.dll

    libstdc++-6.dll not found. Try reinstalling the application libstdc++-6.dll not found

    Because using -static or -static-libgcc or -static-libstdc++ in linker command line options box did not work for me, i copied the first dll file to my project directory from some other directory in my system where i found it (and nowhere in mingw32 folder in C:\DevCpp) and downloaded the second one off the net, my project stopped giving run-time errors like "FirsCVProj has stopped working. Contact the application vendor for support" or ".dll was not found"

    But it became worse, because at runtime, i did see the command output window of the program i was compiling in my project, but that just appeared for like a fraction of a second!

    I rebuild the whole thing a couple of times, but then remembering Einstein's quote "Repeating the same thing and expecting a different output is insanity" i stopped.. That's where you guys come in. Here's the compilation log from which i can't help wondering why the files aren't linking.

    Compiler: OpenCV
    Building Makefile: "C:\Users\ronnieaka\Desktop\PROJ\openCV\Makefile.win"
    Executing make clean
    rm -f ../../../../../opencv/samples/c/facedetect.o FirstCVproj.exe
    g++.exe -c ../../../../../opencv/samples/c/facedetect.cpp -o ../../../../../opencv/samples/c/facedetect.o -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include" -I"C:/opencv/include" -I"C:/opencv/include/opencv" -I"C:/opencv/include/opencv2" -I"C:/opencv/build/include" -I"C:/opencv/build/include/opencv" -I"C:/opencv/build/include/opencv2" -L"C:\opencv\build\x86\mingw\lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231
    g++.exe: -llibopencv_core231: linker input file unused because linking not done
    g++.exe: -llibopencv_imgproc231: linker input file unused because linking not done
    g++.exe: -llibopencv_calib3d231: linker input file unused because linking not done
    g++.exe: -llibopencv_video231: linker input file unused because linking not done
    g++.exe: -llibopencv_features2d231: linker input file unused because linking not done
    g++.exe: -llibopencv_ml231: linker input file unused because linking not done
    g++.exe: -llibopencv_highgui231: linker input file unused because linking not done
    g++.exe: -llibopencv_objdetect231: linker input file unused because linking not done
    g++.exe: -llibopencv_contrib231: linker input file unused because linking not done
    g++.exe: -llibopencv_legacy231: linker input file unused because linking not done
    g++.exe: -llibopencv_flann231: linker input file unused because linking not done
    g++.exe ../../../../../opencv/samples/c/facedetect.o -o "FirstCVproj.exe" -L"lib" -L"C:/opencv/build/x86/mingw/lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231
    Execution terminated
    Compilation successful


    i also tried opencv\samples\c\mushroom.cpp and i got the output window in which the details of the program were printed, about its author etc, but then i got the windows message: "FirstCVproj has stopped working"

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: linker problem with opencv and devcpp

    Quote Originally Posted by ronnieaka View Post
    ibgcc_s_dw2_1.dll not found. Try reinstalling the application

    Program can't find libgcc_s_dw2-1.dll

    libstdc++-6.dll not found. Try reinstalling the application libstdc++-6.dll not found
    Missing DLLs have nothing to do with "linker problem".
    If you got these messages then your App had linked successfully.
    But expected DLLs were not found in the path(s) they were supposed to be.
    So, search for missing DLLs and try to put them in the correct folder...
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: linker problem with opencv and devcpp

    The gcc flag -c means 'compile but do not link' so that's why the -l inputs not are used (and the informational text is emitted)

    See for instance http://linux.die.net/man/1/gcc
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center