[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Undeclared defines



Hej kodere

Jeg har arbejdet på et library i et stykke tid og får pludselig en underlig fejl.
Jeg compiler normalt med g++3 (version 3.0.2), og det giver ingen fejl. Men når jeg prøver med g++ (version 2.96), får jeg følgende:


sslug@sslug net++]$ g++ -c Mutex.cpp
Mutex.cpp: In method `Mutex::~Mutex ()':
Mutex.cpp:16: `EBUSY' undeclared (first use this function)
Mutex.cpp:16: (Each undeclared identifier is reported only once for
each function it appears in.)
Mutex.cpp: In method `void Mutex::enter ()':
Mutex.cpp:25: `EINVAL' undeclared (first use this function)
Mutex.cpp:28: `EDEADLK' undeclared (first use this function)
Mutex.cpp:26: warning: unreachable code at beginning of switch
statement
Mutex.cpp: In method `bool Mutex::tryEnter ()':
Mutex.cpp:42: warning: unreachable code at beginning of switch
statement
Mutex.cpp: In method `void Mutex::exit ()':
Mutex.cpp:61: `EPERM' undeclared (first use this function)
Mutex.cpp:59: warning: unreachable code at beginning of switch
statement

Alle de uerklærede defines er fejlkoder fra pthread_mutex_* funktionerne og skulle være defineret i pthread.h, som jeg har inkluderet. Jeg har fået koderne fra 'man' siderne til funktionerne, så de burde være gode nok, og som sagt så virker det fint med g++3.
Hvad skal jeg gøre, for at få det til at compile med g++ ?


Følgende er linje 20-34 fra filen hvor et par af fejlene ligger:
void Mutex::enter()
{
int err = pthread_mutex_lock(&m_mutex);
switch(err)
{
case EINVAL:
throw ThreadException("The mutex has not been properly initialized.");
break;
case EDEADLK:
throw ThreadException("The mutex is already locked by the calling thread");
break;
default:
break;
}
}



VH


Robert

--
"I could use a heart. A human heart.
I need to pump a lot of blood out of my basement"
                                         - Bender




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *