[linux-audio-dev] a little C++ guidance needed

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Tue Apr 15 12:03:59 UTC 2003


On Tue, 15 Apr 2003, Dave Phillips wrote:

> Greetings:
>
>   I'm trying to compile the Teknocomposer software but have run into a
> problem that Nick doesn't know what to do about (beyond suggesting I
> update my compiler). Here's the failure point:
>
> make[2]: Entering directory `/home/dlphilp/teknocomposer/teknocomposer'
> c++ -DHAVE_CONFIG_H -I. -I. -I..     -O2 -fno-exceptions -fno-check-new
> -fexceptions  -c MainWindow.cxx
> MainWindow.cxx:405: parse error before `{'
> MainWindow.cxx:410: destructors must be member functions
> MainWindow.cxx:410: virtual outside class declaration
> MainWindow.cxx:418: parse error before `}'
> MainWindow.cxx:420: syntax error before `*'
> MainWindow.cxx:424: invalid use of undefined type `class
> AppSoundDriver'
> MainWindow.cxx:404: forward declaration of `class AppSoundDriver'
> MainWindow.cxx:435: invalid use of undefined type `class
> AppSoundDriver'

I suspect this is the real problem - include the declaration of
AppSoundDriver class somewhere before the first instantiation.
I.e. not forward declare it, but include its header (I suspect
the code from below is not actually MainWindow.cxx, but some other
parts snipped together).

Richard.

> MainWindow.cxx:404: forward declaration of `class AppSoundDriver'
> MainWindow.cxx: In method `AppSoundDriver::~AppSoundDriver ()':
> MainWindow.cxx:443: `sizeof' applied to incomplete type
> `AppSoundDriver'
> MainWindow.cxx: At top level:
> MainWindow.cxx:446: invalid use of undefined type `class
> AppSoundDriver'
> MainWindow.cxx:404: forward declaration of `class AppSoundDriver'
> MainWindow.cxx:464: invalid use of undefined type `class
> AppSoundDriver'
> MainWindow.cxx:404: forward declaration of `class AppSoundDriver'
> MainWindow.cxx:471: invalid use of undefined type `class
> AppSoundDriver'
> MainWindow.cxx:404: forward declaration of `class AppSoundDriver'
> MainWindow.cxx: In function `int main (int, char *)':
> MainWindow.cxx:2508: `theSoundDriver' undeclared (first use this
> function)
> MainWindow.cxx:2508: (Each undeclared identifier is reported only once
> for each function it appears in.)
> MainWindow.cxx:2508: parse error before `('
> make[2]: *** [MainWindow.o] Error 1
> make[2]: Leaving directory `/home/dlphilp/teknocomposer/teknocomposer'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/dlphilp/teknocomposer'
> make: *** [all-recursive-am] Error 2
>
>
>   The specific code block looks like this:
>
> /////////////////////////////////////////////////////////////////////////////
> class AppSoundDriver : public SoundDriver
> {
> public:
>
>     AppSoundDriver(REAL sample_rate, int num_channels);
>
>     virtual ~AppSoundDriver();
>
>   // this is called to fill buffer with len samples
>     void Run(REAL * buffer, uint32 len);
>
>     void Start();
>     void Stop();
>
> };
>
> AppSoundDriver * theSoundDriver;
>
> AppSoundDriver::AppSoundDriver(REAL sample_rate, int num_channels)
> {
> printf("Starting Sound Driver...\n");
>  #ifdef PORT_AUDIO_DRIVER
>   openPortAudio(this, sample_rate, num_channels);
> #endif
> #ifdef ALSA_DRIVER
>   openALSADriver(this, sample_rate, num_channels);
> #endif
> }
>
> AppSoundDriver::~AppSoundDriver()
> {
> printf("Closing sound driver...\n");
> #ifdef PORT_AUDIO_DRIVER
>   closePortAudio();
> #endif
> #ifdef ALSA_DRIVER
>   closeALSADriver();
> #endif
> }
>
> //////////////////////////////////////////////////////////////////////
>
>
> Nick's advice to upgrade my compiler is timely (I'm using GCC 2.96 from
> RH 7.2) but unfortunately I can't make the switch right now. If there's
> an obvious (or non-obvious) solution to my dilemma I'd be happy to hear
> of it.
>
> Best regards,
>
> == Dave Phillips
>
> 	The Book Of Linux Music & Sound at http://www.nostarch.com/lms.htm
> 	The Linux Soundapps Site at http://linux-sound.org
>
> Currently listening to: Ravi Shankar, "Raga Bilashkani Todi"
>




More information about the Linux-audio-dev mailing list