Discussion:
[SDL] How to add cpp file to SDL
leagor
2016-11-26 10:49:53 UTC
Permalink
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)" (??***@YAPAXI@Z)

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

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



How to resolve it?
Ryan C. Gordon
2016-11-27 06:38:46 UTC
Permalink
Post by leagor
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.
leagor
2016-11-27 14:14:09 UTC
Permalink
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-***@lists.libsdl.org] On Behalf Of Ryan C. Gordon
Sent: Sunday, November 27, 2016 2:39 PM
To: SDL Development List <***@lists.libsdl.org>
Subject: Re: [SDL] How to add cpp file to SDL
Post by leagor
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.

Loading...