Menu

Using libvfw32.a

2007-04-03
2012-09-26
  • Nobody/Anonymous

    Hi

    I want to use functions from this library (acording to MSDN, they are defined in vfw.h and vfw32.lib). I'm just linking so I didn't have the chance to use any dlls but, which dll does this .a file link to? Cause I have no vfw32.dll on my system.

    I read the original vfw32.lib links to three different dlls (MSVFW32.dll, AVIFIL32.dll, and AVICAP32.dll), but, does libvfw32.a do the same?

    Thanks

     
    • Nobody/Anonymous

      Well, I got no problems in compiling because I modified vfw.h so that it contained the functions I needed (as recommended on other post in the forum). Is that right?

      Thanks

       
    • Nobody/Anonymous

      What did you add to the header, the function definitions or just the declarations? You need to be more specific about the problem. The program compiled ok - so are you having runtime problems? If so what?

      If you included the function definitions in the header file that would fix the problem. But it would be better to just use the library.

       
    • Nobody/Anonymous

      Ok, I'll be specific:

      I want, for instance, to use the function capCreateCaptureWindow, which is, according to MSDN, declared in vfw.h and for which vfw32.lib must be used.

      However, this function is not declared on the vfw.h file inlcuded on Dev C++. So it's evident that when trying to compile I get a not declared function error.

      So, following the advice of a thread of this forum (http://sourceforge.net/forum/message.php?msg_id=3502115), I downloaded the vfw.h file from Borland compiler, and used the declarations found there to modify the vfw.h file from Dev C++. I must say that I only added the declaration, since the function itself is nowhere to be found on the header file (which makes sense, I think).

      When doing so, I get no more errors at compiling, and even I get through the linking process successfully (in which I used the libvfw32.a file from Dev C++).

      Now, since Video For Windows is kind of complicated, I have only written some code for testing the compiling and linking process to check if I can use the library (only some function calls that make really nothing). So that's why I don't really now if all what I did makes sense; that is, if I can use the functions from libvfw32.a (vfw32.lib).

      Sorry if my explanations were not clear enough before. I hope I have made my point now and you can give me a hand.

      Thanks!!!

       
    • Nobody/Anonymous

      OK I think I've got it now. The Microsoft vfw.h has the function but MinGW doesn't. You need to install the latest Windows API package from the MinGW website. Go to
      http://www.mingw.org/download.shtml
      Find the "current" Windows API package. Download the bin file w32api-3.6.tar.gz and extract the files. There will be two folders, an include and a lib. Copy all the files into the corresponding include and lib folders in Dev-Cpp. Your API will then be up to date and you should be able to compile without making changes. I checked the header and the function you need is defined in the current file.

      The old libvfw32.a didn't have the function definition you needed so copying the declaration into the header wouldn't work. If you could have copied the definition into the header then the procedure you were using would have probably worked.

       
    • Anonymous

      Anonymous - 2007-04-04

      >> I read the original vfw32.lib links to three different dlls (MSVFW32.dll, AVIFIL32.dll, and AVICAP32.dll), but, does libvfw32.a do the same?

      Simply yes.

      libvfw32.a is an export library provided with MinGW. It does nothing but provide link stubs for API functions. MSVFW32.dll, AVIFIL32.dll, and AVICAP32.dll are system DLLs provided by Windows to provide the VfW API. If the export did not use these system APIs it would not be VfW but rather something else!

      Clifford

       
    • Nobody/Anonymous

      Hi

      Thanks for your help. I did what you said but there's a problem. I need not only capCreateCaptureWindow but also some others. And those are not included on this vfw.h file either. Does this mean I cannot use VFW with DevC++ to do what I want to do (getting pics from a webcam)? If not, do you know another way to do it with DevC++?

      I'm enclosing the compiling log for a Video Capture file, in which I use more or less the functions I need, just to let you know:

      g++.exe -c VideoCapture.cpp -o VideoCapture.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.2.3/include" -I"C:/Qt/4.2.3/include/QtCore" -I"C:/Qt/4.2.3/include/QtGui" -I"C:/Qt/4.2.3/include/QtSql" -I"C:/Qt/4.2.3/include/QtNetwork" -I"C:/Qt/4.2.3/include/QtOpenGL" -I"C:/Qt/4.2.3/include/QtXml" -I"C:/Qt/4.2.3/include/Qt3Support"

      In file included from VideoCapture.cpp:2:
      VideoCapture.h:29: error: `CAPDRIVERCAPS' does not name a type

      VideoCapture.h:51: error: `LPVIDEOHDR' has not been declared

      VideoCapture.h:51: error: ISO C++ forbids declaration of `lpheader' with no type

      VideoCapture.cpp: In member function BOOL VideoCapture::Initialize()': VideoCapture.cpp:47: error:capSetUserData' undeclared (first use this function)

      VideoCapture.cpp:47: error: (Each undeclared identifier is reported only once for each function it appears in.)

      VideoCapture.cpp:51: error: `capSetCallbackOnVideoStream' undeclared (first use this function)

      VideoCapture.cpp:56: error: `capDriverConnect' undeclared (first use this function)

      VideoCapture.cpp: In member function BOOL VideoCapture::StartCapture()': VideoCapture.cpp:75: error:capCaptureSequenceNoFile' undeclared (first use this function)

      VideoCapture.cpp: In member function BOOL VideoCapture::StopCapture()': VideoCapture.cpp:91: error:capCaptureStop' undeclared (first use this function)

      VideoCapture.cpp:92: error: `capCaptureAbort' undeclared (first use this function)

      VideoCapture.cpp: In member function void VideoCapture::Destroy()': VideoCapture.cpp:108: error:capCaptureAbort' undeclared (first use this function)

      VideoCapture.cpp:111: error: `capSetCallbackOnVideoStream' undeclared (first use this function)

      VideoCapture.cpp:116: error: `capDriverDisconnect' undeclared (first use this function)

      VideoCapture.cpp: In member function BOOL VideoCapture::SetCapturePara()': VideoCapture.cpp:128: error:CAPTUREPARMS' undeclared (first use this function)

      VideoCapture.cpp:128: error: expected `;' before "CapParms"

      VideoCapture.cpp:131: error: `CapParms' undeclared (first use this function)

      VideoCapture.cpp:131: error: `capCaptureGetSetup' undeclared (first use this function)

      VideoCapture.cpp:139: error: `capCaptureSetSetup' undeclared (first use this function)

      VideoCapture.cpp:143: error: `capGetVideoFormat' undeclared (first use this function)

      VideoCapture.cpp:148: error: `capSetVideoFormat' undeclared (first use this function)

      VideoCapture.cpp: In member function int VideoCapture::AllocateMemory(tagBITMAPINFO*&)': VideoCapture.cpp:171: error:capGetVideoFormat' undeclared (first use this function)

      VideoCapture.cpp: At global scope:
      VideoCapture.cpp:243: error: `LPVIDEOHDR' has not been declared

      VideoCapture.cpp:244: error: ISO C++ forbids declaration of `lphdr' with no type

      VideoCapture.cpp: In function LRESULT OnCaptureVideo(HWND__*, int)': VideoCapture.cpp:246: error:capGetUserData' undeclared (first use this function)

      make.exe: *** [VideoCapture.o] Error 1

      Thanks!

       
    • Nobody/Anonymous

      Apparently the MinGW header still doesn't have everything.

      Try using the borland header and lib file. Copy the Borland header and lib into the dev-cpp folders. To link to the library you probably will not be able to use -lvfw32.
      Use the "Add Library or Object" button to add the full filename, including the .lib extension. This is not a MinGW file but it usually works.

      Let me know what happens.

       
    • Nobody/Anonymous

      When doing so I get these compiling errors:

      g++.exe -c VideoCapture.cpp -o VideoCapture.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.2.3/include" -I"C:/Qt/4.2.3/include/QtCore" -I"C:/Qt/4.2.3/include/QtGui" -I"C:/Qt/4.2.3/include/QtSql" -I"C:/Qt/4.2.3/include/QtNetwork" -I"C:/Qt/4.2.3/include/QtOpenGL" -I"C:/Qt/4.2.3/include/QtXml" -I"C:/Qt/4.2.3/include/Qt3Support"

      In file included from VideoCapture.h:5,
      from VideoCapture.cpp:2:
      C:/Dev-Cpp/include/vfw.h:63: error: `DWORD' does not name a type

      C:/Dev-Cpp/include/vfw.h:71: error: `LONG' does not name a type

      C:/Dev-Cpp/include/vfw.h:72: error: `LONG' does not name a type

      In file included from C:/Dev-Cpp/include/vfw.h:86,
      from VideoCapture.h:5,
      from VideoCapture.cpp:2:
      C:/Dev-Cpp/include/mmsystem.h:904: error: `DWORD' does not name a type

      C:/Dev-Cpp/include/mmsystem.h:905: error: `UINT' does not name a type

      C:/Dev-Cpp/include/mmsystem.h:906: error: typedef `UINT' is initialized (use typeof instead)

      C:/Dev-Cpp/include/mmsystem.h:906: error: `CALLBACK' was not declared in this scope

      C:/Dev-Cpp/include/mmsystem.h:906: error: `YIELDPROC' was not declared in this scope

      C:/Dev-Cpp/include/mmsystem.h:906: error: expected ,' or;' before '(' token

      C:/Dev-Cpp/include/mmsystem.h:912: error: `DWORD' does not name a type

      C:/Dev-Cpp/include/mmsystem.h:913: error: `DWORD' does not name a type

      ... (there are too many more and it stops trying to compile)

       
    • Nobody/Anonymous

      You need to include windows.h before vfw.h. The Borland header files are different. MinGW will include windows.h if vfw.h needs it. Borland does not.

      You also haven't linked to the lib file. Do this in Project Options > Parameters, Linker options.

       
    • Nobody/Anonymous

      Just one more error:

      g++.exe -c VideoCapture.cpp -o VideoCapture.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.2.3/include" -I"C:/Qt/4.2.3/include/QtCore" -I"C:/Qt/4.2.3/include/QtGui" -I"C:/Qt/4.2.3/include/QtSql" -I"C:/Qt/4.2.3/include/QtNetwork" -I"C:/Qt/4.2.3/include/QtOpenGL" -I"C:/Qt/4.2.3/include/QtXml" -I"C:/Qt/4.2.3/include/Qt3Support"

      In file included from VideoCapture.h:5,
      from VideoCapture.cpp:2:
      C:/Dev-Cpp/include/vfw.h:108:1: warning: "mmioFOURCC" redefined
      In file included from C:/Dev-Cpp/include/windows.h:80,
      from VideoCapture.cpp:1:
      C:/Dev-Cpp/include/mmsystem.h:26:1: warning: this is the location of the previous definition
      In file included from VideoCapture.h:5,
      from VideoCapture.cpp:2:
      C:/Dev-Cpp/include/vfw.h:1797:23: mmreg.h: No such file or directory

      make.exe: *** [VideoCapture.o] Error 1

      If I copy the mmreg.h file from Borland into DevC++/include, the I get this:

      g++.exe -c VideoCapture.cpp -o VideoCapture.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Qt/4.2.3/include" -I"C:/Qt/4.2.3/include/QtCore" -I"C:/Qt/4.2.3/include/QtGui" -I"C:/Qt/4.2.3/include/QtSql" -I"C:/Qt/4.2.3/include/QtNetwork" -I"C:/Qt/4.2.3/include/QtOpenGL" -I"C:/Qt/4.2.3/include/QtXml" -I"C:/Qt/4.2.3/include/Qt3Support"

      In file included from VideoCapture.h:5,
      from VideoCapture.cpp:2:
      C:/Dev-Cpp/include/vfw.h:108:1: warning: "mmioFOURCC" redefined
      In file included from C:/Dev-Cpp/include/windows.h:80,
      from VideoCapture.cpp:1:
      C:/Dev-Cpp/include/mmsystem.h:26:1: warning: this is the location of the previous definition

      g++.exe VideoCapture.o -o "Proyecto1.exe" -L"C:/Dev-Cpp/lib" -L"C:/Qt/4.2.3/lib" C:/Dev-Cpp/lib/vfw32.lib

      C:/Dev-Cpp/lib/vfw32.lib: file not recognized: File format not recognized
      collect2: ld returned 1 exit status

      make.exe: *** [Proyecto1.exe] Error 1

      (vfw32.lib is the one from Borland too)

      Thanks!

       
    • Anonymous

      Anonymous - 2007-04-05

      >> You also haven't linked to the lib file.

      You can tell that!? The log does not yet show the link step because compilation has not completed. Compiler command lines do not include linker options. So you are wrong to suggest this; it may be true, but you cannot conclude that from the log as posted.

      Clifford

       
    • Anonymous

      Anonymous - 2007-04-05

      >> Just one more error:

      Actually I count two.

      (1) warning: "mmioFOURCC" redefined
      -------------------------------
      The log clearly shows that the symbol mmioFOURCC is defined at both vfw.h line 108, and mmsystem.h line 26. It seems you have modified your VfW header, so you will need to sort it out. In the provided vfw.h and mmsystem.h the definition is wrapped in a multiple definition guard thus:

      ifndef mmioFOURCC

      define mmioFOURCC ...

      endif

      You probably need to do this in your vfw.h implementation.

      (2) C:/Dev-Cpp/lib/vfw32.lib: file not recognized: File format not recognized
      -------------------------------------------------------------------------

      This is clearly not an GNU export library (which would be called libvfw32.a). If the one provided with MinGW is missing parts, you cannot simply substitute a Borland or Microsoft one. It won't work. If you have the microsoft version, you can convert it using reimp.exe. Otherwise you will have to load the library programatically with LoadLibrary().

      Clifford

       
    • Nobody/Anonymous

      Hi again

      I used the reimp.exe thing and it seems to work. At least it compiles and links with no poblem. I still don't know if the functions actually work, but given I'm using the Borland header file and the a files I got out of the lib file from Microsoft, I think it looks pretty good.

      Once I get it working I'll let you know for future doubts from other users.

      Thank you all guys for your help. I wish I could buy you a bier. XD

       
    • Nobody/Anonymous

      Congratulations,

      You have plugged, patched, mangled, and mutilated a program to get it to work. You are now a REAL programmer :-)

       
      • Wayne Keen

        Wayne Keen - 2007-04-06

        Better than me for sure.

        ;)

        Wayne

         
    • Nobody/Anonymous

      There are two kinds of .a files. Some provide the linkage to dlls and others contain the functions in the .a file. The MinGW libvfw32.a is thge same file as vfw32.lib in Microsoft. It probably calls the same dlls. There is no vfw32.dll because all of the needed functions are contained in the .a file. If you are having problems compiling the program post your compile log.

       

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.