Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7864113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:41:23+00:00 2026-06-02T23:41:23+00:00

I have problems with compiling file Mutex.h -> It belongs to library STK (Synthesis

  • 0

I have problems with compiling file Mutex.h -> It belongs to library STK (Synthesis Toolkit C++).

I’ve just included files, that I needed (“RtWvOut.h”, Mutex.h/cpp, Stk.h/cpp, WvOut.h)
and during the compiling the following problems disapeared.
Thanks for your answers 🙂


d:\kari\Mutex.h:67: Error:C2146: syntax error : missing ‘;’ before identifier ‘mutex_’
d:\kari\Mutex.h:67: Error:C4430: missing type specifier – int assumed. Note: C++ does not support default-int
d:\kari\Mutex.h:68: Error:C2146: syntax error : missing ‘;’ before identifier ‘condition_’
d:\kari\Mutex.h:68: Error:C4430: missing type specifier – int assumed. Note: C++ does not support default-int


here is code of Mutex.h

    #ifndef STK_MUTEX_H
    #define STK_MUTEX_H

    #include "Stk.h"

    #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)){

      #include <pthread.h>
      typedef pthread_mutex_t MUTEX;
      typedef pthread_cond_t CONDITION;
    }
    #elif defined(__OS_WINDOWS__){

      #include <windows.h>
      #include <process.h>
      typedef CRITICAL_SECTION MUTEX;
      typedef HANDLE CONDITION;
    }
    #endif

    namespace stk {

    /**************************************************/
    /*! \class Mutex
        \brief STK mutex class.

        This class provides a uniform interface for
        cross-platform mutex use.  On Linux and IRIX
        systems, the pthread library is used. Under
        Windows, critical sections are used.

        by Perry R. Cook and Gary P. Scavone, 1995-2011.
    */
    /***************************************************/

    class Mutex : public Stk
    {
     public:
      //! Default constructor.
      Mutex();

      //! Class destructor.
      ~Mutex();

      //! Lock the mutex.
      void lock(void);

      //! Unlock the mutex.
      void unlock(void);

      //! Wait indefinitely on the mutex condition variable.
      /*!
        The mutex must be locked before calling this function, and then
        subsequently unlocked after this function returns.
       */
      void wait(void);

      //! Signal the condition variable.
      /*!
        The mutex must be locked before calling this function, and then
                subsequently unlocked after this function returns.
       */
      void signal(void);

    protected:

     MUTEX mutex_;                    ##################x LINE 67
     CONDITION condition_;            ##################  LINE 68

    };
    } // stk namespace
    #endif

and code for Mutex.cpp

/***************************************************/
/*! \class Mutex
    \brief STK mutex class.

    This class provides a uniform interface for
    cross-platform mutex use.  On Linux and IRIX
    systems, the pthread library is used. Under
    Windows, critical sections are used.

    by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

#include "Mutex.h"

namespace stk {

Mutex :: Mutex()
{

#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_mutex_init(&mutex_, NULL);
  pthread_cond_init(&condition_, NULL);

#elif defined(__OS_WINDOWS__)

  InitializeCriticalSection(&mutex_);
  condition_ = CreateEvent(NULL,  // no security
                           true,  // manual-reset
                           false, // non-signaled initially
                           NULL); // unnamed

#endif 
}

Mutex :: ~Mutex()
{
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_mutex_destroy(&mutex_);
  pthread_cond_destroy(&condition_);

#elif defined(__OS_WINDOWS__)

  DeleteCriticalSection(&mutex_);
  CloseHandle( condition_ );

#endif 
}

void Mutex :: lock()
{
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_mutex_lock(&mutex_);

#elif defined(__OS_WINDOWS__)

  EnterCriticalSection(&mutex_);

#endif 
}

void Mutex :: unlock()
{
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_mutex_unlock(&mutex_);

#elif defined(__OS_WINDOWS__)

  LeaveCriticalSection(&mutex_);

#endif 
}

void Mutex :: wait()
{
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_cond_wait(&condition_, &mutex_);

#elif defined(__OS_WINDOWS__)

  WaitForMultipleObjects(1, &condition_, false, INFINITE);

#endif 
}

void Mutex :: signal()
{
#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))

  pthread_cond_signal(&condition_);

#elif defined(__OS_WINDOWS__)

  SetEvent( condition_ );

#endif 
}
} // stk namespace

and code, where is Mutex.h included: (RtWvOut.h)

#ifndef STK_RTWVOUT_H
#define STK_RTWVOUT_H

#include "WvOut.h"
#include "RtAudio.h"
#include "Mutex.h"

namespace stk {

/***************************************************/
/*! \class RtWvOut
    \brief STK realtime audio (blocking) output class.

    This class provides a simplified interface to RtAudio for realtime
    audio output.  It is a subclass of WvOut.  This class makes use of
    RtAudio's callback functionality by creating a large ring-buffer
    into which data is written.  This class should not be used when
    low-latency is desired.

    RtWvOut supports multi-channel data in interleaved format.  It is
    important to distinguish the tick() method that outputs a single
    sample to all channels in a sample frame from the overloaded one
    that takes a reference to an StkFrames object for multi-channel
    and/or multi-frame data.

    by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

class RtWvOut : public WvOut
{
 public:

  //! Default constructor.
  /*!
    The default \e device argument value (zero) will select the
    default output device on your system.  The first device enumerated
    by the underlying audio API is specified with a value of one.  The
    default buffer size of RT_BUFFER_SIZE is defined in Stk.h.  An
    StkError will be thrown if an error occurs duing instantiation.
  */
  RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
           int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );

  //! Class destructor.
  ~RtWvOut();

  //! Start the audio output stream.
  /*!
    The stream is started automatically, if necessary, when a
    tick() method is called.
  */
  void start( void );

  //! Stop the audio output stream.
  /*!
    It may be necessary to use this method to avoid undesireable
    audio buffer cycling if you wish to temporarily stop audio output.
  */
  void stop( void );

  //! Output a single sample to all channels in a sample frame.
  /*!
    If the device is "stopped", it is "started".
  */
  void tick( const StkFloat sample );

  //! Output the StkFrames data.
  /*!
    If the device is "stopped", it is "started".  The number of
    channels in the StkFrames argument must equal the number of
    channels specified during instantiation.  However, this is only
    checked if _STK_DEBUG_ is defined during compilation, in which
    case an incompatibility will trigger an StkError exception.
  */
  void tick( const StkFrames& frames );

  // This function is not intended for general use but must be
  // public for access from the audio callback function.
  int readBuffer( void *buffer, unsigned int frameCount );

 protected:

  RtAudio dac_;
  Mutex mutex_;
  bool stopped_;
  unsigned int readIndex_;
  unsigned int writeIndex_;
  long framesFilled_;
  unsigned int status_; // running = 0, emptying buffer = 1, finished = 2

};

} // stk namespace

#endif
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:41:25+00:00Added an answer on June 2, 2026 at 11:41 pm

    Did you tell it what platform it’s running on? If you look at this line of code:

    #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)){
    

    You can see, that it needs to be told somehow. Something must define the appropriate __OS_... flag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two .c files and one .h file included from them both. In
I have problems with dealing with widows within a multicols environment, that is, I
I have problems getting some of my views aligned in a relative layout that
I'm having problems with compiling a project I'm working on. Everything else works just
I have heard that setting the --prefix=PREFIX option when compiling PHP on linux will
Ok, what we have: Program written on C which compiling and running without problems
I have a large set off files (hdf) that I need to enable search
I have some problems using OpenSSL. I'm following the tutorial for compiling OpenSSL for
I have some problems with compiling hello world application in kubuntu linux 11.10. This
i'm just learning java, and i meet some problems. Here we have simple factory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.