[g++] Kompilacja

Kuba kuba.podgorski w gmail.com
Pon, 26 Lis 2007, 20:06:08 GMT


Witaki,
wg mnie tutaj trzeba popatrzeć na to co gdzie i dlaczego jest
'includowane', bo czegoś tutaj za dużo... (może dlatego usunięcie
pomogło, mimo, że to chyba nie jest super rozwiązanie).

Paptrzmy na pierwsze 2 linie. W pliku /usr/include/pthread.h:285:
deklarujemy typ pthread_t jako wskaźnik na strukturę, zaś w pliku
nagłówkowym /usr/include/bits/pthreadtypes.h:36 ta sama nazwa jest
wykorzytywana jako unsigned long int.
Tak naprawde deklaracja pthread_t jest chyba brana z sys/types.h (ale
moze nie na wszystkich systemach).

Moim zdaniem pthread_t powinno byc typem prostym (zazwyczaj
ulong-iem). Popatrz na pthread.h - moze tam cos jest nie tak,  moze
mozna wykorzystac sys/types.h zamiast bits/
Tak czy siak ciezko mi radzic na slepo.

Powodzenia, Kuba.

ps: a jakby nie dzialalo poslij kod - pobawie sie ;)



On Nov 26, 2007 4:48 PM, Krzysztof Mularski <geek w pino.pl> wrote:
> Ostatnio miałem problem ze skompilowaniem jakiekolwiek projektu ...
> teraz okazuje się że nie mogę skompilować nawet własnych... czy
> ktokolwiek zna przyczynę tego zamieszania ... albo chociaż podejrzewa co
> może być lekarstwem?
>
> O to komunikaty (wszystkie negatywne) jakie otrzymuję przy próbie
> kompilacji projektu posługującego się phtread
>
> /usr/include/pthread.h:285: error: conflicting declaration 'typedef
> struct pthread_st* pthread_t'
> /usr/include/bits/pthreadtypes.h:36: error: 'pthread_t' has a previous
> declaration as 'typedef long unsigned int pthread_t'
> /usr/include/pthread.h:286: error: conflicting declaration 'typedef
> struct pthread_attr_st* pthread_attr_t'
> /usr/include/bits/pthreadtypes.h:43: error: 'pthread_attr_t' has a
> previous declaration as 'typedef union pthread_attr_t pthread_attr_t'
> /usr/include/pthread.h:287: error: conflicting declaration 'typedef int
> pthread_key_t'
> /usr/include/bits/pthreadtypes.h:109: error: 'pthread_key_t' has a
> previous declaration as 'typedef unsigned int pthread_key_t'
> /usr/include/pthread.h:289: error: conflicting declaration 'typedef int
> pthread_mutexattr_t'
> /usr/include/bits/pthreadtypes.h:79: error: 'pthread_mutexattr_t' has a
> previous declaration as 'typedef union pthread_mutexattr_t
> pthread_mutexattr_t'
> /usr/include/pthread.h:290: error: conflicting declaration 'typedef
> struct pthread_mutex_st* pthread_mutex_t'
> /usr/include/bits/pthreadtypes.h:73: error: 'pthread_mutex_t' has a
> previous declaration as 'typedef union pthread_mutex_t pthread_mutex_t'
> /usr/include/pthread.h:291: error: conflicting declaration 'typedef int
> pthread_condattr_t'
> /usr/include/bits/pthreadtypes.h:105: error: 'pthread_condattr_t' has a
> previous declaration as 'typedef union pthread_condattr_t
> pthread_condattr_t'
> /usr/include/pthread.h:292: error: conflicting declaration 'typedef
> struct pthread_cond_st* pthread_cond_t'
> /usr/include/bits/pthreadtypes.h:99: error: 'pthread_cond_t' has a
> previous declaration as 'typedef union pthread_cond_t pthread_cond_t'
> /usr/include/pthread.h:293: error: conflicting declaration 'typedef int
> pthread_rwlockattr_t'
> /usr/include/bits/pthreadtypes.h:142: error: 'pthread_rwlockattr_t' has
> a previous declaration as 'typedef union pthread_rwlockattr_t
> pthread_rwlockattr_t'
> /usr/include/pthread.h:294: error: conflicting declaration 'typedef
> struct pthread_rwlock_st* pthread_rwlock_t'
> /usr/include/bits/pthreadtypes.h:136: error: 'pthread_rwlock_t' has a
> previous declaration as 'typedef union pthread_rwlock_t
> pthread_rwlock_t'
>


Więcej informacji o liście dyskusyjnej ubuntu-pl