У меня есть ошибка, указывающая на линию Extred C при компиляции с C ++ 17 (Debian 12), но тот же код хорошо сочетается с C ++ 11 (Linux Mint). Есть идеи, почему? Невозможно получить никакой помощи от поставщика. < /P> #ifndef CONDITION_DEF_H
#define CONDITION_DEF_H
/* Condition_def.h; Class definition of class Thread.
*
* Copyright (c) 2000-2004 by Michael Weitzel.
* All rights reserved.
*/
#define SPURIOUS_WAKEUP_SAFE
//#define SPURIOUS_WAKEUP_UNSAFE
extern "C"
{
#include
}
#include "ThreadException.h"
namespace ThreadsPP
{
class Mutex;
/**
* Condition variables.
* The implementation offers the three classical operations
* wait(), signal() and broadcast().
*
* @author Michael Weitzel
* @brief A class implementing condition variables.
* @class Condition Condition.h
*/
class Condition
{
private:
/** pthread condition variable */
pthread_cond_t * pcond_;
/**
* flag; set to true iff the Condition object owns the
* pcond_ (not only shares it)
*/
bool pcowner_;
/**
* A eventually pending exception thrown during
* initialization.
*/
ThreadException * pending_exception_;
public:
/**
* The signal operation.
* Signals (reawakes) the next thread waiting on the
* condition variable.
*/
#if __cplusplus >= 201703L
inline void signal() throw ();
#else
inline void signal() throw (ThreadException);
#endif
/**
* The broadcast operation.
* Signals (reawakes) all threads waiting on the condition variable.
*/
#if __cplusplus >= 201703L
inline void broadcast() throw ();
#else
inline void broadcast() throw (ThreadException);
#endif
#ifdef SPURIOUS_WAKEUP_UNSAFE
/**
* The wait operation.
* Suspends a calling thread and unlocks a Mutex object to open
* a critical section.
*
* @param mutex Mutex object
*/
#if __cplusplus >= 201703L
inline void wait(Mutex & mutex) throw ();
#else
inline void wait(Mutex & mutex) throw (ThreadException);
#endif
/**
* The wait operation with timeout.
* Suspends a calling thread up to a specified timeout and unlocks a
* Mutex object.
*
* @param mutex Mutex object
* @param sec number of seconds for timeout
* @param usec number of microseconds for timeout
*/
#if __cplusplus >= 201703L
#else
inline bool timedwait(Mutex & mutex, long sec, long usec)
throw (ThreadException);
#endif
#endif
#ifdef SPURIOUS_WAKEUP_SAFE
/**
* The wait operation.
* Suspends a calling thread and unlocks a Mutex object to open
* a critical section.
*
* @param mutex Mutex object
*/
#if __cplusplus >= 201703L
inline void wait(Mutex & mutex, bool & predicate) throw ();
#else
inline void wait(Mutex & mutex, bool & predicate) throw (ThreadException);
#endif
/**
* The wait operation with timeout.
* Suspends a calling thread up to a specified timeout and unlocks a
* Mutex object.
*
* @param mutex Mutex object
* @param sec number of seconds for timeout
* @param usec number of microseconds for timeout
*/
#if __cplusplus >= 201703L
inline bool timedwait(Mutex & mutex, long sec, long usec, bool & predicate)
throw ();
#else
inline bool timedwait(Mutex & mutex, long sec, long usec, bool & predicate)
throw (ThreadException);
#endif
#endif
public:
/**
* Copy Constructor.
* Attaches the new Condition object to an existing object.
*
* @param copy existing condition object
*/
inline Condition(Condition const & copy)
: pcond_(copy.pcond_), pcowner_(false) {}
/**
* Constructor.
*/
inline Condition();
/**
* Destructor.
*/
inline ~Condition();
}; // class ThreadsPP::Condition
} // namespace ThreadsPP
#endif
< /code>
Я попытался Google и найти разрешение. Я попытался добавить такой #ifdef, но не решил. < /P>
#ifdef __cplusplus
extern "C"
{
#include
}
#endif
Подробнее здесь: https://stackoverflow.com/questions/794 ... -pthread-h
Ожидаемый инициализатор перед внешней частью, включив Pthread.h ⇐ Linux
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
В чем разница между серверной частью ndk и серверной частью cpp в AOSP?
Anonymous » » в форуме Android - 0 Ответы
- 105 Просмотры
-
Последнее сообщение Anonymous
-