This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Why do not it works with g++?


What is it wrong?.
This code works with gcc -c p.c -o p -L/lib/thread
but not with g++ -c p.c -o p -L/lib/thread (have I to put some option
more?):

The error message is the next one:
p.c: In function `int main(int, char **)':
p.c:16: warning: ANSI C++ forbids implicit conversion from `void *' in
argument
passing
p.c:16: error: passing `short int **' as argument 4 of `st_new(void *
(*)(void *
), void *, st_attr *, short int *)'
p.c:17: warning: ANSI C++ forbids implicit conversion from `void *' in
argument
passing
p.c:17: error: passing `short int **' as argument 4 of `st_new(void *
(*)(void *
), void *, st_attr *, short int *)'
____________________________________________________________________


# include <pthread.h>
# include <stdio.h>


void imp(void *ptr);

main(int argc,char *argv[])

{
   pthread_attr_t thr_attr1;
   pthread_t *thr1,*thr2;
   char *m1="hola";
    char *m2="mundo";

pthread_create(&thr1,pthread_attr_default,(void*) &imp,(void*)m1);
pthread_create(&thr2,pthread_attr_default,(void *) &imp,(void*)m2);

}

void imp (void *ptr)
{
 char *m;
  m=(char *) ptr;
  printf ("%s ",m);
}





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]