How to add cpp file to SDL

I want to add video capture to SDL 2.0.5. On Windows, it is based on
DirectShow, and DirectShow require to use a lot of class, for example
IFilter, IPin. But when I add them to SDL, compile successfully, link fail.

Below is some error information.

1>vtrans.obj : error LNK2001: unresolved external symbol __purecall

1>winctrl.obj : error LNK2001: unresolved external symbol __purecall

1>transip.obj : error LNK2001: unresolved external symbol “void * __cdecl
operator new(unsigned int)” (??2 at YAPAXI@Z)

1>winutil.obj : error LNK2001: unresolved external symbol “void * __cdecl
operator new(unsigned int)” (??2 at YAPAXI@Z)

1>transip.obj : error LNK2001: unresolved external symbol _memcpy

How to resolve it?

How to resolve it?

You probably need to link against Microsoft’s C++ runtime. SDL’s Visual
Studio project files don’t link against any C or C++ runtime at all
(we implement our own malloc() using Win32 calls directly, etc). This is
not my area of expertise, but it’s probably just a simple change in the
project files to fix this (but if you’re planning on submitting this as
a patch for SDL, we can’t take in a C++ dependency).

Alternately: I presume DirectShow is a COM interface; you can call these
from C with some magic macros. Here’s an example of calling some
IDirectSound methods, to see this sort of thing in action:

https://hg.libsdl.org/SDL/file/18f1e8b0737d/src/audio/directsound/SDL_directsound.c#l210

–ryan.

With my ability, I have to give up adding cpp file temporarily.

Very much hope that SDL can support capture video!> ----- Original Message -----

From: SDL [mailto:sdl-bounces@lists.libsdl.org] On Behalf Of Ryan C. Gordon
Sent: Sunday, November 27, 2016 2:39 PM
To: SDL Development List
Subject: Re: [SDL] How to add cpp file to SDL

How to resolve it?

You probably need to link against Microsoft’s C++ runtime. SDL’s Visual
Studio project files don’t link against any C or C++ runtime at all (we
implement our own malloc() using Win32 calls directly, etc). This is not my
area of expertise, but it’s probably just a simple change in the project
files to fix this (but if you’re planning on submitting this as a patch for
SDL, we can’t take in a C++ dependency).

Alternately: I presume DirectShow is a COM interface; you can call these
from C with some magic macros. Here’s an example of calling some
IDirectSound methods, to see this sort of thing in action:

https://hg.libsdl.org/SDL/file/18f1e8b0737d/src/audio/directsound/SDL_direct
sound.c#l210

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org