Author Topic: Declaring library "vfw" causes compilation error  (Read 3694 times)

0 Members and 1 Guest are viewing this topic.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Declaring library "vfw" causes compilation error
« on: September 29, 2020, 08:00:58 pm »
I'm trying to write a program in QB64 that captures from the webcam and I've found many programs online showing how to do it and they all have one thing in common: using vfw.h
However, when I try to use it, I get this IDE error:

Quote
C++ Compilation failed (Check .\internal\temp\compilelog.txt)

I checked the file and this is what it showed:

Quote
In file included from C:/Users/Zachary/Desktop/QB64 x64/internal/c/c_compiler/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from C:/Users/Zachary/Desktop/QB64 x64/internal/c/c_compiler/x86_64-w64-mingw32/include/inttypes.h:11,
                 from parts/core/glew/include/GL/glew.h:294,
                 from parts/core/src.c:2,
                 from common.h:35,
                 from qbx.cpp:1:
os.h:54:23: error: declaration does not declare anything [-fpermissive]
         #define int64 __int64
                       ^~~~~~~
compilation terminated due to -Wfatal-errors.
Shuwatch!

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: Declaring library "vfw" causes compilation error
« Reply #1 on: September 29, 2020, 09:32:17 pm »
What's the purpose of including this header file? What definitions are you using from it? You're likely going to have to rewrite them in QB anyway.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Declaring library "vfw" causes compilation error
« Reply #2 on: September 29, 2020, 09:41:31 pm »
@luke
I'm trying to make a QB64 version of something like this:
https://www.dreamincode.net/forums/topic/193519-win32-webcam-program/
Shuwatch!

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: Declaring library "vfw" causes compilation error
« Reply #3 on: September 29, 2020, 11:12:14 pm »
For each function you want to call you need to add it to a DECLARE (CUSTOMTYPE|DYNAMIC) LIBRARY block. You then link with vfw32 directly, no need for a header file.

I'm not savvy enough on details of Windows linking to know whether you should be linking with the vfw32.a static library that comes with mingw or if there's a system-wide dll to use.

However it may all be a moot point because from a casual glance at the linked article it appears the whole shebang is partially driven by handling window events, which you can't really do in QB64.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Declaring library "vfw" causes compilation error
« Reply #4 on: September 29, 2020, 11:14:06 pm »
Ok. Hopefully I can make it work. It's an experiment. I has able to generate the window that would hold the webcam feed but that's as far as I've gotten. I'll keep plugging away and see what I get.
Shuwatch!