The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
How to add cpp file to SDL
ancientli


Joined: 01 Jul 2015
Posts: 45
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@YAPAXI@Z)
1>winutil.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
1>transip.obj : error LNK2001: unresolved external symbol _memcpy

How to resolve it?
How to add cpp file to SDL
Ryan C. Gordon
Guest

Quote:
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.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
How to add cpp file to SDL
ancientli


Joined: 01 Jul 2015
Posts: 45
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:] 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


Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org