PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.45k stars 303 forks source link

Compilation by MSVS for Windows Failed #927

Open sevstels opened 3 months ago

sevstels commented 3 months ago

\src\os\win\pa_win_util.c(174): error C2143: syntax error : missing ';' before 'type' \src\os\win\pa_win_util.c(175): error C2065: 'msg' : undeclared identifier \src\os\win\pa_win_util.c(175): warning C4047: 'function' : 'LPSTR' differs in levels of indirection from 'int' \src\os\win\pa_win_util.c(175): warning C4024: 'WideCharToMultiByte' : different types for formal and actual parameter 5 \src\os\win\pa_win_util.c(176): error C2065: 'msg' : undeclared identifier \src\os\win\pa_win_util.c(176): warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int' \src\os\win\pa_win_util.c(176): warning C4024: 'PaUtil_SetLastHostErrorInfo' : different types for formal and actual parameter 3

pa_win_wasapi.c(1980): error C2143: syntax error : missing ';' before 'type' pa_win_wasapi.c(1980): error C2143: syntax error : missing ';' before 'type' pa_win_wasapi.c(1980): error C2143: syntax error : missing ')' before 'type' pa_win_wasapi.c(1980): error C2143: syntax error : missing ';' before 'type' pa_win_wasapi.c(1980): error C2065: 'i' : undeclared identifier wasapi\pa_win_wasapi.c(1980): warning C4018: '<' : signed/unsigned mismatch pa_win_wasapi.c(1980): warning C4552: '<' : operator has no effect; expected operator with side-effect pa_win_wasapi.c(1980): error C2059: syntax error : ')' pa_win_wasapi.c(1981): error C2065: 'i' : undeclared identifier pa_win_wasapi.c(1981): error C2143: syntax error : missing ';' before '{' pa_win_wasapi.c(1982): error C2065: 'i' : undeclared identifier pa_win_wasapi.c(2222): error C2143: syntax error : missing ';' before 'type' pa_win_wasapi.c(2223): error C2275: 'PaWasapiDeviceInfo' : illegal use of this type as an expression pa_win_wasapi.c(505) : see declaration of 'PaWasapiDeviceInfo' pa_win_wasapi.c(2223): error C2065: 'loopbackWasapiInfo' : undeclared identifier pa_win_wasapi.c(2225): error C2065: 'loopbackDeviceInfo' : undeclared identifier pa_win_wasapi.c(2225): warning C4047: 'function' : 'PaDeviceInfo ' differs in levels of indirection from 'int' pa_win_wasapi.c(2225): warning C4024: 'FillLooopbackDeviceInfo' : different types for formal and actual parameter 2 pa_win_wasapi.c(2225): error C2065: 'loopbackWasapiInfo' : undeclared identifier pa_win_wasapi.c(2225): warning C4047: 'function' : 'PaWasapiDeviceInfo ' differs in levels of indirection from 'int' pa_win_wasapi.c(2225): warning C4024: 'FillLooopbackDeviceInfo' : different types for formal and actual parameter 3 pa_win_wasapi.c(2231): error C2065: 'loopbackDeviceInfo' : undeclared identifier pa_win_wasapi.c(2231): warning C4047: '=' : 'PaDeviceInfo *' differs in levels of indirection from 'int'

pa_win_ds.c(2033): error C2143: syntax error : missing ';' before 'const' pa_win_ds.c(2038): error C2065: 'nativeFormats' : undeclared identifier pa_win_ds.c(2048): error C2065: 'nativeFormats' : undeclared identifier pa_win_ds.c(2359): error C2061: syntax error : identifier 'QueryOutputSpace' pa_win_ds.c(2359): error C2059: syntax error : ';' pa_win_ds.c(2359): error C2059: syntax error : 'type' pa_win_ds.c(2492): warning C4013: 'QueryOutputSpace' undefined; assuming extern returning int

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

RossBencina commented 3 months ago

Given that our CI is passing without error, we need a lot more information here:

What MSVS version? How are you building PortAudio? Are you using the shipped, project files, CMake or some other build method?

sevstels commented 3 months ago

vs2010 The files were added to a common console C++ project in the usual standard way. But this unfortunately does not work. I temporarily got around the problem by using a dll, but it's not a solution. With the dll everything is assembled and works fine.

RossBencina commented 3 months ago

The files were added to a common console C++ project in the usual standard way

I'm not sure what "the usual standard way" is but PortAudio sources will not build without the correct build settings. You'd need to at least make sure that you are setting all of the include paths and defines correctly in the project build settings.

syntaro commented 3 months ago

Can you try CMAKE gui?

sevstels commented 3 months ago

I can't use CMake. Because the whole huge project is built in Visual Studio.

syntaro commented 3 months ago

ah, CMake GUI will Create VisutlStudio Project file. Once you could try CMake, It will work. CMake -> Customize Build Option -> VisualStudio Project File. Make library and reference it from your main project.