Я пытаюсь скомпилировать некоторый код на С ++, который я написал, на другой машине с CentOS.Я пытаюсь скомпилировать в Ubuntu 16.04 и, несмотря на наличие одинаковых версий gcc (4.8) и clion (2018.3), код не будет компилироваться должным образом.Одна из ошибок:
error: '_GLIBCXX_TXN_SAFE_DYN' does not name a type
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT {
Я искал в интернете эту ошибку или пытался выяснить, что означает _GLIBCXX_TXN_SAFE_DYN, но ничего не смог найти.Код по-прежнему правильно компилируется на машинах CentOS.Возможно, мне не хватает какой-то зависимости или чего-то еще, но я не могу понять это.
class TestException : public std::exception {
public:
/*!
* @brief Default constructor to create a new instance of @c TestException
*
* @param what A description of what might have gone wrong in the test
* @param file The file name where the error occurred (i.e. @c __FILE__ )
* @param function The function name in which the error occurred (i.e. @c __FUNCTION__ )
* @param line The line number where the error occurred. (i.e. @c__LINE__ )
*/
TestException(const std::string what, const std::string file, const std::string function, const int line) {
std::stringstream s;
s << "TestException in file \"" << file << "\" in function \"" << function << "\" at line " << line
<< ": " << what;
_msg = s.str();
}
//! @brief Return the error message as a string for use in error messages or tracing
virtual const char*
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT {
return _msg.c_str();
}
private:
std::string _msg; //!< @brief The formatted message string.
};