Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OpenCV in MFC App

OpenCV in MFC App

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studioquestion
23 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S SoMad

    I don't know the details of building the OpenCV libraries. I know there is a BUILD_SHARED_LIBS flag, but I don't know if you can set that to OFF (like you have done) and somewhere else specify the /MD switch and have it correctly build all the lib files without a dependency on the DLLs. Soren Madsen

    "When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty

    D Offline
    D Offline
    Don Guy
    wrote on last edited by
    #21

    I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.

    S 2 Replies Last reply
    0
    • D Don Guy

      I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.

      S Offline
      S Offline
      SoMad
      wrote on last edited by
      #22

      :thumbsup: It sounds like you are making progress. There is another approach to this and that is how I often deal with these kind of scenarios where I need to include 3rd party libraries (like Live555 and FFmpeg), but I want to reduce the number of distributable files and the interdependency of those files. Since you just mentioned the WIN32 DLL, this might also be what you are planning on doing in the end. Instead of just building the EXE and distributing that, I build the EXE and a DLL for interfacing to the 3rd party library. That way I can tailor the DLL to work with the 3rd party library according to my needs, while compiling the library according to its needs. You should be able to build your DLL with the /MT setting and build your EXE with the /MD and Shared MFC DLL setting then dynamically load the DLL. Soren Madsen

      "When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty

      1 Reply Last reply
      0
      • D Don Guy

        I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.

        S Offline
        S Offline
        SoMad
        wrote on last edited by
        #23

        Don Guy wrote:

        Now the next part am working on is adding an XML file to the project and compiling it into the project.

        I assume you are putting it in the resource. XResFile - Files Stored in Resources: Part 1 - Text and Binary[^] Soren Madsen

        "When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups