Board index » cppbuilder » LINK Error with ksmedia.h

LINK Error with ksmedia.h


2008-03-04 08:37:38 AM
cppbuilder23
Hello Sir,
I need help...
I try to create WASAPI application and include ks.h and ksmedia.h on my
project, I got the link error message as below,
How to setting the m_wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; without any
link error? This setting is work on MS Visual Studio 2005. Is a bug on
BCB2007?
Thanks for any comments,
James
/*Code Start
#include <ks.h>
#include <ksmedia.h>
m_wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
m_wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
Code End*/
//Error Message
[ILINK32 Error] Error: Unresolved external '_KSDATAFORMAT_SUBTYPE_PCM'
referenced from D:\VRDRUMMIDI PROJECT\WASAPI\WASPAI
DEMOWAVE2\DEBUG\WAVEFILE.OBJ
 
 

Re:LINK Error with ksmedia.h

"James5950" < XXXX@XXXXX.COM >wrote in message
Quote
I try to create WASAPI application and include ks.h and ksmedia.h
on my project, I got the link error message as below
You did not include the .lib file that actually defines the contents of
KSDATAFORMAT_SUBTYPE_PCM. However...
Quote
How to setting the m_wfx.SubFormat ... without any link error?
... you cannot use VC++ static libraries in Borland projects, so you will
have to define the contents of KSDATAFORMAT_SUBTYPE_PCM in your code
directly, ie:
// KSDATAFORMAT_SUBTYPE_PCM = 00000001-0000-0010-8000-00aa00389b71
const GUID KSDATAFORMAT_SUBTYPE_PCM { 0x00000001, 0x0000, 0x0010, {0x80,
0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} };
Quote
This setting is work on MS Visual Studio 2005. Is a bug on BCB2007?
No. It is merely an incompatibility between Borland and Microsoft
compilers.
Gambit
 

Re:LINK Error with ksmedia.h

Thanks Remy,
More questions,
Quote
You did not include the .lib file that actually defines the contents of
KSDATAFORMAT_SUBTYPE_PCM. However...
Which .lib need include? I can not find about ksmedia.lib in BCB2007
library directory.
Quote
... you cannot use VC++ static libraries in Borland projects, so you will
have to define the contents of KSDATAFORMAT_SUBTYPE_PCM in your code
directly, ie:

// KSDATAFORMAT_SUBTYPE_PCM = 00000001-0000-0010-8000-00aa00389b71
const GUID KSDATAFORMAT_SUBTYPE_PCM { 0x00000001, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} };
DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_PCM)
DEFINE_GUIDSTRUCT("00000001-0000-0010-8000-00aa00389b71",
KSDATAFORMAT_SUBTYPE_PCM);
Could you provide me more detail about define this GUID? I try it can not
work.
James
 

{smallsort}

Re:LINK Error with ksmedia.h

"James5950" < XXXX@XXXXX.COM >wrote in message
Quote
Which .lib need include?
KSDATAFORMAT_SUBTYPE_PCM is defined in ksuser.lib, which cannot be used in
BCB projects.
Quote
I can not find about ksmedia.lib in BCB2007 library directory.
There is no such file to begin with.
Quote
I try it can not work.
Did you try undefining the original KSDATAFORMAT_SUBTYPE_PCM?
#undef KSDATAFORMAT_SUBTYPE_PCM
const GUID KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} };
Otherwise, you will have to give it a different name, ie:
const GUID my_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} };
m_wfx.SubFormat = my_KSDATAFORMAT_SUBTYPE_PCM;
Either way, ignore the original #define macros, they don't work without the
.lib to back them up.
Gambit
 

Re:LINK Error with ksmedia.h

Hello Remy,
It's work now, without link error.
Thank you,
James