Discussion:
Windows WASAPI build errors
(too old to reply)
Graham Goode
2018-07-19 06:51:47 UTC
Permalink
Hi,

I last built portaudio WASAPI dlls for Windows in 2014 using the
stable release from that year. WASAPI built fine. On that same build
environment I have todays code snapshot, and I get the following error
messages in Visual Studio (32-bit build project) when attempting a
build:
2> pa_win_wasapi.c
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4921):
error C2275: 'PaWasapiStream' : illegal use of this type as an
expression
3> ..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(574)
: see declaration of 'PaWasapiStream'
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4921):
error C2065: 'stream' : undeclared identifier
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4922):
error C2065: 'stream' : undeclared identifier
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4922):
warning C4047: '==' : 'int' differs in levels of indirection from
'void *'
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2065: 'stream' : undeclared identifier
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2223: left of '->out' must point to struct/union
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2065: 'stream' : undeclared identifier
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2223: left of '->in' must point to struct/union
3>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
fatal error C1903: unable to recover from previous error(s); stopping
compilation
3> Generating Code...
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4921):
error C2275: 'PaWasapiStream' : illegal use of this type as an
expression
2> ..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(574)
: see declaration of 'PaWasapiStream'
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4921):
error C2065: 'stream' : undeclared identifier
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4922):
error C2065: 'stream' : undeclared identifier
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4922):
warning C4047: '==' : 'int' differs in levels of indirection from
'void *'
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2065: 'stream' : undeclared identifier
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2223: left of '->out' must point to struct/union
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2065: 'stream' : undeclared identifier
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
error C2223: left of '->in' must point to struct/union
2>..\..\source\pa_snapshot_19July2018\portaudio\src\hostapi\wasapi\pa_win_wasapi.c(4925):
fatal error C1903: unable to recover from previous error(s); stopping
compilation
2> Generating Code...
3>
3>Build FAILED.

Do I need to update the version of WASAPI code from a Microsoft SDK,
or is this a bug in portaudio or in the CMAKE setup?

Kind regards,
GrahamG
Graham Goode
2018-07-19 06:55:46 UTC
Permalink
And using Visual Studio 2010, maybe an update to VS is in order?
Post by Graham Goode
Hi,
I last built portaudio WASAPI dlls for Windows in 2014 using the
stable release from that year. WASAPI built fine. On that same build
environment I have todays code snapshot, and I get the following error
messages in Visual Studio (32-bit build project) when attempting a
Nick Appleton
2018-07-19 07:30:58 UTC
Permalink
Hi Graham,

I’ve had a look at the code and this is certainly visual studio not supporting mixed-declarations. Modern versions of the Microsoft C compiler can deal with this - but the one included with VS2010 is unlikely to.

I’m guessing we still care about supporting old VS versions (and C90) and should fix the issue.

Does anyone have an older version of VS they can test a fix with?
Post by Graham Goode
And using Visual Studio 2010, maybe an update to VS is in order?
Post by Graham Goode
Hi,
I last built portaudio WASAPI dlls for Windows in 2014 using the
stable release from that year. WASAPI built fine. On that same build
environment I have todays code snapshot, and I get the following error
messages in Visual Studio (32-bit build project) when attempting a
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Graham Goode
2018-07-19 07:43:12 UTC
Permalink
Hi Nick,

Thanks. I did a quick Google for the error message and thought that it
was likely VS2010 not supporting the declaration.

If you send me the changes I can do a quick edit of the file and see
if it builds :).
Post by Nick Appleton
I’m guessing we still care about supporting old VS versions (and C90) and
should fix the issue.
Does anyone have an older version of VS they can test a fix with?
Graham Goode
2018-07-19 09:37:37 UTC
Permalink
Moving the declaration to the beginning of the block solves the issue:

PaError PaWasapi_GetAudioClient(PaStream *pStream, void
**pAudioClient, int bOutput)
{
PaWasapiStream *stream = (PaWasapiStream *)pStream;
if (stream == NULL)
return paBadStreamPtr;

if (pAudioClient == NULL)
return paUnanticipatedHostError;

(*pAudioClient) = (bOutput == TRUE ? stream->out.clientParent :
stream->in.clientParent);

return paNoError;
}
Post by Graham Goode
Hi Nick,
Thanks. I did a quick Google for the error message and thought that it
was likely VS2010 not supporting the declaration.
If you send me the changes I can do a quick edit of the file and see
if it builds :).
Post by Nick Appleton
I’m guessing we still care about supporting old VS versions (and C90) and
should fix the issue.
Does anyone have an older version of VS they can test a fix with?
Graham Goode
2018-07-19 09:39:32 UTC
Permalink
Opps, I should have left the if statements in their original order and
just move the declaration, so:

PaError PaWasapi_GetAudioClient(PaStream *pStream, void
**pAudioClient, int bOutput)
{
PaWasapiStream *stream = (PaWasapiStream *)pStream;

if (pAudioClient == NULL)
return paUnanticipatedHostError;

if (stream == NULL)
return paBadStreamPtr;

(*pAudioClient) = (bOutput == TRUE ? stream->out.clientParent :
stream->in.clientParent);

return paNoError;
}
Post by Graham Goode
PaError PaWasapi_GetAudioClient(PaStream *pStream, void
**pAudioClient, int bOutput)
{
PaWasapiStream *stream = (PaWasapiStream *)pStream;
if (stream == NULL)
return paBadStreamPtr;
if (pAudioClient == NULL)
return paUnanticipatedHostError;
stream->in.clientParent);
return paNoError;
}
Post by Graham Goode
Hi Nick,
Thanks. I did a quick Google for the error message and thought that it
was likely VS2010 not supporting the declaration.
If you send me the changes I can do a quick edit of the file and see
if it builds :).
Post by Nick Appleton
I’m guessing we still care about supporting old VS versions (and C90) and
should fix the issue.
Does anyone have an older version of VS they can test a fix with?
Dmitry Kostjuchenko
2018-07-19 11:14:53 UTC
Permalink
Hi Graham,

Thank you for pointing to this issue, will apply necessary correction. Your
proposal to move [PaWasapiStream *stream = (PaWasapiStream *)pStream] in
front of the function is fully correct.

Best regards,
Dmitry.
Post by Graham Goode
Opps, I should have left the if statements in their original order and
PaError PaWasapi_GetAudioClient(PaStream *pStream, void
**pAudioClient, int bOutput)
{
PaWasapiStream *stream = (PaWasapiStream *)pStream;
if (pAudioClient == NULL)
return paUnanticipatedHostError;
if (stream == NULL)
return paBadStreamPtr;
stream->in.clientParent);
return paNoError;
}
Post by Graham Goode
PaError PaWasapi_GetAudioClient(PaStream *pStream, void
**pAudioClient, int bOutput)
{
PaWasapiStream *stream = (PaWasapiStream *)pStream;
if (stream == NULL)
return paBadStreamPtr;
if (pAudioClient == NULL)
return paUnanticipatedHostError;
stream->in.clientParent);
return paNoError;
}
Post by Graham Goode
Hi Nick,
Thanks. I did a quick Google for the error message and thought that it
was likely VS2010 not supporting the declaration.
If you send me the changes I can do a quick edit of the file and see
if it builds :).
I’m guessing we still care about supporting old VS versions (and C90)
and
should fix the issue.
Does anyone have an older version of VS they can test a fix with?
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Chris
2018-07-19 10:46:42 UTC
Permalink
Can't you download older versions of VS from MS? I have VS 2008 which I have used for PortAudio in the past but lack the time to test it.


-----Original Message-----
From: Nick Appleton <***@appletonaudio.com>
To: portaudio list <***@lists.columbia.edu>
Sent: Thu, Jul 19, 2018 12:33 am
Subject: Re: [Portaudio] Windows WASAPI build errors

Hi Graham,I’ve had a look at the code and this is certainly visual studio not supporting mixed-declarations. Modern versions of the Microsoft C compiler can deal with this - but the one included with VS2010 is unlikely to.I’m guessing we still care about supporting old VS versions (and C90) and should fix the issue.Does anyone have an older version of VS they can test a fix with?> On 19 Jul 2018, at 4:55 pm, Graham Goode <***@gmail.com> wrote:> > And using Visual Studio 2010, maybe an update to VS is in order?> >> On 7/19/18, Graham Goode <***@gmail.com> wrote:>> Hi,>> >> I last built portaudio WASAPI dlls for Windows in 2014 using the>> stable release from that year. WASAPI built fine. On that same build>> environment I have todays code snapshot, and I get the following error>> messages in Visual Studio (32-bit build project) when attempting a>> build:> _______________________________________________> Portaudio mailing list> ***@lists.columbia.edu> https://lists.columbia.edu/mailman/listinfo/portaudio> _______________________________________________Portaudio mailing ***@lists.columbia.eduhttps://lists.columbia.edu/mailman/listinfo/portaudio
Loading...