Menu

Linker Error: Undefined ref. to [OpenCV func]

J Chan
2008-11-03
2012-09-26
  • J Chan

    J Chan - 2008-11-03

    This is my first time using Dev-C++, and my first time making DLLs, so bear with me if I make any beginner mistakes. I have read the sticky and did what I thought was relevant to the files already, including name changes to without spaces.

    I am using Windows XP, and I have been using Dev-C++ to make a DLL, which calls the OpenCV library and makes a DLL with Canny edge detection capabilities. While that worked fine, when I tried to merge that with previous code (written in Visual Studio, which successfully compiled in Visual Studio), which uses proprietary video capturing driver libraries, and did all the tweakings I could think of, the code still gave a long list of linker errors for all the new driver functions.

    The proprietary video driver is Euresys E-vision, and in the working code made in Visual Studio, multicam.lib, EasyMsVs71.lib and EImgMsVs71.lib are what is needed for the new code to work. Every other libary, startin with "cv" is OpenCV.

    The compile log is as follows:

    Compiler: Default compiler
    Building Makefile: "C:\Mohsen\PushingDLLs\NewCanny[dev-CPP]\Makefile.win"
    Finding dependencies for file: C:\Mohsen\PushingDLLs\NewCanny[dev-CPP]\CannyFrameGrabberDLL.cpp
    Executing make...
    make.exe -f "C:\Mohsen\PushingDLLs\NewCanny[dev-CPP]\Makefile.win" all
    dllwrap.exe --output-def libNewCanny.def --driver-name c++ --implib libNewCanny.a CannyFrameGrabberDLL.o -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/lib" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/cxcore/include" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/cv/include" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/otherlibs/highgui" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/cvaux/include" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/OpenCV/otherlibs/cvcam/include" -L"lib" -lhighgui -lcv -lcxcore -lcvaux -lcvcam -lmulticam -lEasyMs71 -lEImgMs71 -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CameraLibs/Multicam/Lib" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CameraLibs/Multicam" -L"C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CameraLibs" --no-export-all-symbols --add-stdcall-alias --def Canny.def CameraLibs/Multicam/Lib/multicam.lib CameraLibs/libEImgMs71.lib CameraLibs/libEasyMs71.lib OpenCV/lib/cv.lib OpenCV/lib/cvaux.lib OpenCV/lib/cxcore.lib OpenCV/lib/cvcam.lib OpenCV/lib/highgui.lib -lgmon -g3 -o NewCanny.dll

    CannyFrameGrabberDLL.o(.text+0x2d1): In function GrabImage': C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:20: undefined reference toMcOpenDriver'
    CannyFrameGrabberDLL.o(.text+0x2e7):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:23: undefined reference to McCreate' CannyFrameGrabberDLL.o(.text+0x302):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:24: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x352):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:26: undefined reference to McSetParamStr' CannyFrameGrabberDLL.o(.text+0x3a2):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:28: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x3f2):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:31: undefined reference to McSetParamStr' CannyFrameGrabberDLL.o(.text+0x442):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:33: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x492):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:35: undefined reference to McSetParamInt' CannyFrameGrabberDLL.o(.text+0x4e2):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:37: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x531):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:42: undefined reference to McGetParamInt' CannyFrameGrabberDLL.o(.text+0x580):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:44: undefined reference toMcGetParamInt'

    CannyFrameGrabberDLL.o(.text+0x642):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:60: undefined reference to McCreate' CannyFrameGrabberDLL.o(.text+0x695):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:64: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x6e8):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:67: undefined reference to McSetParamInt' CannyFrameGrabberDLL.o(.text+0x73f):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:70: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x796):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:75: undefined reference to `McSetParamInt'

    CannyFrameGrabberDLL.o(.text+0x7ed):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:79: undefined reference to McSetParamInst' CannyFrameGrabberDLL.o(.text+0x847):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:83: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x897):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:86: undefined reference to McSetParamInt' CannyFrameGrabberDLL.o(.text+0x8e7):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:88: undefined reference toMcSetParamInt'
    CannyFrameGrabberDLL.o(.text+0x941):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:91: undefined reference to McWaitSignal' CannyFrameGrabberDLL.o(.text+0x990):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:100: undefined reference toMcGetParamInt'
    CannyFrameGrabberDLL.o(.text+0x9dc):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:105: undefined reference to EImage<unsigned char>::EImage()' CannyFrameGrabberDLL.o(.text+0xa03):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:109: undefined reference toMcGetParamInt'
    CannyFrameGrabberDLL.o(.text+0xa55):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:111: undefined reference to McGetParamInt' CannyFrameGrabberDLL.o(.text+0xaa4):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:114: undefined reference toMcGetParamInt'
    CannyFrameGrabberDLL.o(.text+0xb18):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:119: undefined reference to EImage<unsigned char>::SetImagePtr(int, int, void*, int)' CannyFrameGrabberDLL.o(.text+0xb23):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:127: undefined reference toMcDelete'
    CannyFrameGrabberDLL.o(.text+0xb28):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:128: undefined reference to McCloseDriver' CannyFrameGrabberDLL.o(.text+0xb91):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:134: undefined reference toEImage<unsigned char>::~EImage()'
    CannyFrameGrabberDLL.o(.text+0xbcd):C:/Mohsen/PushingDLLs/NewCanny[dev-CPP]/CannyFrameGrabberDLL.cpp:134: undefined reference to `EImage<unsigned char>::~EImage()'
    collect2: ld returned 1 exit status

    dllwrap.exe: c++ exited with status 1

    make.exe: *** [NewCanny.dll] Error 1

    Execution terminated

    ============================
    Any help would be appreciated.

     
    • cpns

      cpns - 2008-11-04

      The fact that they have a .lib extension and "MsVs71" strongly suggests that these are MS specific libraries. If they are export libraries for a DLL you can still use the DLL through LoadLibrary/GetProcAddress so long as tre API is C not C++.

      Similarly it is possible to convert MS DLL export libraries using the reimp tool.

      Another option is to upgrade Dev-C++'s MinGW/GCC installation with a (currently experimental/unofficial) GCC 4.x version which can use MS exports libraries.

      However, the simple solution is just to continue to use VC++, why would you choose to switch to Dev-C++?

      Clifford

       
    • J Chan

      J Chan - 2008-11-04

      Thanks for the prompt reply, will try reimp first.

      What is the difference between MS-specific libraries and normal libraries?
      (Or more generally, VS C++ and other C++ IDEs?)

      Oh by the way, I was "avoiding copyright issues" with VC++.
      Wasn't worth the greater evil of trouble, I guess.

       
    • J Chan

      J Chan - 2008-11-05

      Ah, I see. Thanks for the explanation, it has a lot of conceptual adhesiveness.

      I have VC++ myself, but the place I work for doesn't; where I work the programming language is LabVIEW (which is hardly even considered one), going through teh hassle of introducing a legal version of VC++ into the workplace is above my lowly rank of peon to do so, and I have no motivation whatsoever to get through all the red tape.

      The DLL was just to have a memory-efficient quick fix to the all-too-slow image processing portion of LabVIEW code; I never intended it to swell up into this annoying problem. Thanks again for your help.

       
      • Wayne Keen

        Wayne Keen - 2008-11-05

        I have seen several organizations "fall in love" with LabView - going through the "this is the greatest thing on Earth" to "Lets do everything in it" to "This might not have been a good idea".

        Keep the lesson here in mind. Libraries are not standard (for the most part), and you will fiind yourself having to recompile them when you go to a new OS or compiler, sometimes even, just upgrade your compiler.(GCC-4.2 to GCC-4.3 is giving us some issues as we speak)

        Wayne

         
      • cpns

        cpns - 2008-11-05

        > going through teh hassle of introducing a legal version of VC++ into the
        > workplace is above my lowly rank of peon to do so, and I have no
        > motivation whatsoever to get through all the red tape.

        Where have you been!? VC++ 2008 Express Edition is both free and legal for commercial use. If you can manage with Dev-C++ you can certainly manage with the Express Edition rather than the paid for version since it has far greater functionality, and you get a working debugger!

        To only thing you need to be aware of is that the Express edition does not include a deployment wizard to installer generator. To deploy applications to machines without the development tools installed you will have to install the VC++2008 Redistributable package on them so that they have all the necessary runtime DLLs - this is a once only operation per machine.

        http://www.microsoft.com/express/product/default.aspx

        http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en

        Clifford

         
        • Wayne Keen

          Wayne Keen - 2008-11-05

          Depending on the location, weird rules can apply as to what can be put on a machine. I have seen it where administrators don't want to put the express version on because, it seems, they worry about how that looks on an audit. Why that looks worse than something like Dev, I have not a clue.

          Wayne

           
    • J Chan

      J Chan - 2008-11-06

      Thanks for the info. I'm not a programmer, and I self-taught myself C++ and DLL writing, so I never really was in touch with different programming software much. Programming wasn't part of my internship work description, but somehow I ended up having to do it anyways. Oh well.

      At least now I know VS 2008 Express Version is free. =) Let's hope my supervisor buys the idea.

       
    • cpns

      cpns - 2008-11-04

      There is no such thing as a "normal library", they are all specific to a particular toolchain, although there may be some interoperability, and often a common object file format.

      The Library format is not specific to an IDE but rather the toolchain. The IDE is just the tools integrator.

      What are teh "copyright issues" with using VC++? I would suggest that teh EULA for MSVC++ is far more flexible that the dreaded GPL.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.