ofTheo / videoInput

A video capture library for windows.
http://muonics.net/school/spring05/videoInput/
358 stars 176 forks source link

Can QtMinGW64Bits compile videoInput? #51

Closed pcha75 closed 2 years ago

pcha75 commented 2 years ago

Hello everybody, I hope you are good. I have a simple question to ask: I managed to compile videoInput using MSVC19, but when it comes to compile it using QtMinGW64bits, it spits some linking error messages out :

/objects.a(VideoInput.cpp.obj):VideoInput.cpp:(.rdata$.refptr.MEDIATYPE_Interleaved[.refptr.MEDIATYPE_Interleaved]+0x0): undefined reference to `MEDIATYPE_Interleaved'
/objects.a(VideoInput.cpp.obj):VideoInput.cpp:(.rdata$.refptr.LOOK_UPSTREAM_ONLY[.refptr.LOOK_UPSTREAM_ONLY]+0x0): undefined reference to `LOOK_UPSTREAM_ONLY'
/objects.a(VideoInput.cpp.obj):VideoInput.cpp:(.rdata$.refptr.IID_IAMCrossbar[.refptr.IID_IAMCrossbar]+0x0): undefined reference to `IID_IAMCrossbar'

Has anybody already solved this problem? Thank you! :)

ofTheo commented 2 years ago

We use videoInput in openFrameworks with mingw64 / msys2.

Did you try building with make? This is how we build it for mingw64/32: https://github.com/openframeworks/apothecary/blob/master/apothecary/formulas/videoInput.sh#L45-L48

You could also try grabbing the libs from the OF release here: https://openframeworks.cc/versions/v0.11.2/of_v0.11.2_msys2_mingw64_release.zip

pcha75 commented 2 years ago

Thank you for your reply!

Did you try building with make?

Yes, it generates a .a file, but I do not know how to use it in my own CMake-based project... I mean, do you provide a .h file which allows me to use functions/methods in this .a library? Also, videoInput compiles and executes well when using the 32 bits version of MinGW.

pcha75 commented 2 years ago

Hi, I managed to compile and execute videoInput using the 64 bits version of MinGW: the problem was to link to the right strmbase.lib. The one available in videoInput repository is 32 bits compiled version. You need to use the 64 bits version in order to compile and execute videoInput with MinGW 64 bits. You can find the 64 bits version directly in your Windows 10 operating system here: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\strmbase.lib. Just in case, following is a minimal CMakeLists.txt file that I wrote which compiles and executes videoInput:

cmake_minimum_required(VERSION 3.5)

project(mingw-videoInput LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(${PROJECT_NAME}
    "main.cpp" # File where a videoInput object is instanciated.
    "videoInput/videoInput.cpp"
    "videoInput/videoInput.h"
    )

target_include_directories(${PROJECT_NAME} PRIVATE
  DShow/include/
  )

target_link_libraries(${PROJECT_NAME} PRIVATE
    "${CMAKE_SOURCE_DIR}/DShow/lib/strmbase.lib"
    )

Good day!