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. Link problem (using avifile)

Link problem (using avifile)

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studiodebugging
12 Posts 5 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.
  • Z Zizilamoroso

    Again some newbie-problems ;P I want to use the AVIFile API in my c++ project. Including the "Vfw.h" header file is not a problem, the various datatypes such as PAVIFILE can be used. But when the project tries to link to the windows dll (mswfv32.dll), the linker says:

    Linking...
    AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileInit@0
    AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileExit@0
    Debug/MultiKaka.exe : fatal error LNK1120: 2 unresolved externals

    I've already tried to add the dll manualy in project->settings->debug->additional_dlls So, I guess this is probably a how-to-call-a-dll-topic :confused: Inluding the headerfile is not enough :confused:
    [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


    X| Bluute tette! X|

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Are you sure that the definition and prototype of _AVIFileInit is the same?

    Z 1 Reply Last reply
    0
    • Z Zizilamoroso

      Again some newbie-problems ;P I want to use the AVIFile API in my c++ project. Including the "Vfw.h" header file is not a problem, the various datatypes such as PAVIFILE can be used. But when the project tries to link to the windows dll (mswfv32.dll), the linker says:

      Linking...
      AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileInit@0
      AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileExit@0
      Debug/MultiKaka.exe : fatal error LNK1120: 2 unresolved externals

      I've already tried to add the dll manualy in project->settings->debug->additional_dlls So, I guess this is probably a how-to-call-a-dll-topic :confused: Inluding the headerfile is not enough :confused:
      [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


      X| Bluute tette! X|

      R Offline
      R Offline
      RockNix
      wrote on last edited by
      #3

      There are two ways to use a DLL: 1) static use You need a header-file and a lib-file added to your project. Than you can directly call the functions declared in the header file. (Due to the linker errors it seems the lib-file is missing in your project, adding only the dll won`t work) 2) dynamic use You only need the dll-file. From your source you load the dll by calling LoadLibrary() and get the function pointers by calling GetProcAdress(). So far ... RockNix/// ------------------------------------ www.klangwerker.de Need some articles about Threading, Subclassing, Double Buffering ? Go for it ... Look out for free Win32 Serial Communication Module for VC++ or Borland C++ Builder Visit us on www.klangwerker.de ------------------------------------

      Z 3 Replies Last reply
      0
      • L Lost User

        Are you sure that the definition and prototype of _AVIFileInit is the same?

        Z Offline
        Z Offline
        Zizilamoroso
        wrote on last edited by
        #4

        Yep, source found on msdn library.
        [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


        X| Bluute tette! X|

        1 Reply Last reply
        0
        • R RockNix

          There are two ways to use a DLL: 1) static use You need a header-file and a lib-file added to your project. Than you can directly call the functions declared in the header file. (Due to the linker errors it seems the lib-file is missing in your project, adding only the dll won`t work) 2) dynamic use You only need the dll-file. From your source you load the dll by calling LoadLibrary() and get the function pointers by calling GetProcAdress(). So far ... RockNix/// ------------------------------------ www.klangwerker.de Need some articles about Threading, Subclassing, Double Buffering ? Go for it ... Look out for free Win32 Serial Communication Module for VC++ or Borland C++ Builder Visit us on www.klangwerker.de ------------------------------------

          Z Offline
          Z Offline
          Zizilamoroso
          wrote on last edited by
          #5

          the lib-file is not missing. checked it. Is there a way to view the dll member functions, (not the headerfile)? maybe they've changed. If I use it dynamicaly, can I use the dll-functions more or less in the same manner?
          [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


          X| Bluute tette! X|

          M R L 3 Replies Last reply
          0
          • Z Zizilamoroso

            the lib-file is not missing. checked it. Is there a way to view the dll member functions, (not the headerfile)? maybe they've changed. If I use it dynamicaly, can I use the dll-functions more or less in the same manner?
            [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


            X| Bluute tette! X|

            M Offline
            M Offline
            Maxwell Chen
            wrote on last edited by
            #6

            frisco wrote: Is there a way to view the dll member functions Use the depends.exe tool comes with your VC++. Maxwell Chen No code is good code.

            1 Reply Last reply
            0
            • Z Zizilamoroso

              the lib-file is not missing. checked it. Is there a way to view the dll member functions, (not the headerfile)? maybe they've changed. If I use it dynamicaly, can I use the dll-functions more or less in the same manner?
              [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


              X| Bluute tette! X|

              R Offline
              R Offline
              RockNix
              wrote on last edited by
              #7

              Within Visual Studio 6.0 there is a tool called "DUMPBIN". Copy this to your DLL Path and type the following line from a console: dumpbin /exports yours.dll A list of the exported functions should be shown. So far ... RockNix/// ------------------------------------ www.klangwerker.de Need some articles about Threading, Subclassing, Double Buffering ? Go for it ... Look out for free Win32 Serial Communication Module for VC++ or Borland C++ Builder Visit us on www.klangwerker.de ------------------------------------

              1 Reply Last reply
              0
              • R RockNix

                There are two ways to use a DLL: 1) static use You need a header-file and a lib-file added to your project. Than you can directly call the functions declared in the header file. (Due to the linker errors it seems the lib-file is missing in your project, adding only the dll won`t work) 2) dynamic use You only need the dll-file. From your source you load the dll by calling LoadLibrary() and get the function pointers by calling GetProcAdress(). So far ... RockNix/// ------------------------------------ www.klangwerker.de Need some articles about Threading, Subclassing, Double Buffering ? Go for it ... Look out for free Win32 Serial Communication Module for VC++ or Borland C++ Builder Visit us on www.klangwerker.de ------------------------------------

                Z Offline
                Z Offline
                Zizilamoroso
                wrote on last edited by
                #8

                I've included the Vfw.h header file, but the lib-file is called vfw32.lib and its in Microsoft Visual Studio\VC98\LIB Does the added 32 cause any harm here? The lib dir is good?
                [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


                X| Bluute tette! X|

                1 Reply Last reply
                0
                • Z Zizilamoroso

                  Again some newbie-problems ;P I want to use the AVIFile API in my c++ project. Including the "Vfw.h" header file is not a problem, the various datatypes such as PAVIFILE can be used. But when the project tries to link to the windows dll (mswfv32.dll), the linker says:

                  Linking...
                  AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileInit@0
                  AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileExit@0
                  Debug/MultiKaka.exe : fatal error LNK1120: 2 unresolved externals

                  I've already tried to add the dll manualy in project->settings->debug->additional_dlls So, I guess this is probably a how-to-call-a-dll-topic :confused: Inluding the headerfile is not enough :confused:
                  [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


                  X| Bluute tette! X|

                  M Offline
                  M Offline
                  Michael P Butler
                  wrote on last edited by
                  #9

                  You need to make sure the Vfw32.lib is included in the ProjectSettings->Link->Input->Object/library modules properties. Michael :-) Communication is the first step towards enlightenment.

                  Z 1 Reply Last reply
                  0
                  • R RockNix

                    There are two ways to use a DLL: 1) static use You need a header-file and a lib-file added to your project. Than you can directly call the functions declared in the header file. (Due to the linker errors it seems the lib-file is missing in your project, adding only the dll won`t work) 2) dynamic use You only need the dll-file. From your source you load the dll by calling LoadLibrary() and get the function pointers by calling GetProcAdress(). So far ... RockNix/// ------------------------------------ www.klangwerker.de Need some articles about Threading, Subclassing, Double Buffering ? Go for it ... Look out for free Win32 Serial Communication Module for VC++ or Borland C++ Builder Visit us on www.klangwerker.de ------------------------------------

                    Z Offline
                    Z Offline
                    Zizilamoroso
                    wrote on last edited by
                    #10

                    And I've checked the lib for _AVIFileInit@0 and it's in it, allright. I'm missing something here. :(
                    [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


                    X| Bluute tette! X|

                    1 Reply Last reply
                    0
                    • M Michael P Butler

                      You need to make sure the Vfw32.lib is included in the ProjectSettings->Link->Input->Object/library modules properties. Michael :-) Communication is the first step towards enlightenment.

                      Z Offline
                      Z Offline
                      Zizilamoroso
                      wrote on last edited by
                      #11

                      That's it, allright! :-D I thought that the linker uses the standard libraries in vc98\lib directory by default. But you have to include them on the link-tab. I did that only for the debug-tab. Mike, you're the man ;)
                      [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


                      X| Bluute tette! X|

                      1 Reply Last reply
                      0
                      • Z Zizilamoroso

                        the lib-file is not missing. checked it. Is there a way to view the dll member functions, (not the headerfile)? maybe they've changed. If I use it dynamicaly, can I use the dll-functions more or less in the same manner?
                        [VISUAL STUDIO 6.0] [MFC] [WIN98/2]


                        X| Bluute tette! X|

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        Add vfw32.lib in Project|Settings|Link, Object/Library modules. It's not a static lib but an import lib (you can tell because it contains only names). Your exe will link at runtime to the right dll and more importantly will compile ok too. tried just now with this fantastic test program: #include #include int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int) { AVIFileInit(); AVIFileExit(); return 0; } (I think you can only do the thing with putting libs into your project with static libraries, which contain code as well as import names, but I'm not sure.)

                        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