Answer the question
In order to leave comments, you need to log in
How to call a function in C++?
Python Cython C++
Compiling a library to play wav
cpp
#include <windows.h> //библиотека audiere её требует
#include <conio.h>
#include <audiere.h> //сама библиотека
#pragma comment(lib, "audiere.lib")
using namespace audiere;
class COpenSound // имя класса
{
public: // спецификатор доступа
AudioDevicePtr device = OpenDevice();
OutputStreamPtr sound = OpenSound(device , "test.wav" , false);
sound::play();
}; // конец объявления класса COpenSound
# distutils: language = c++
cdef extern from "SoundPlay.cpp":
cdef cppclass COpenSound:
COpenSound() except +
cdef class OpenSound:
cdef COpenSound *thisptr
def __cinit__(self):
self.thisptr = new COpenSound()
def __dealloc__(self):
del self.thisptr
C:\PyScripterProjects\РасширенияДляPython3НаC++\Sound play>py setup.py build_ext
--inplace
running build_ext
building 'sound_play' extension
C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /
GL /DNDEBUG /MD -IC:\Python36\include -IC:\Python36\include "-IC:\Program Files\
Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files\Windows Kits\10\inc
lude\10.0.10240.0\ucrt" "-IC:\Program Files\Windows Kits\8.1\include\shared" "-I
C:\Program Files\Windows Kits\8.1\include\um" "-IC:\Program Files\Windows Kits\8
.1\include\winrt" /EHsc /Tpsound_play.cpp /Fobuild\temp.win32-3.6\Release\sound_
play.obj
sound_play.cpp
c:\pyscripterprojects\расширениядляpython3наc++\sound play\SoundPlay.cpp(16): er
ror C2653: 'sound': is not a class or namespace name
c:\pyscripterprojects\расширениядляpython3наc++\sound play\SoundPlay.cpp(16): er
ror C4430: missing type specifier - int assumed. Note: C++ does not support defa
ult-int
c:\pyscripterprojects\расширениядляpython3наc++\sound play\SoundPlay.cpp(16): wa
rning C4183: 'play': missing return type; assumed to be a member function return
ing 'int'
error: command 'C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe
' failed with exit status 2
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question