| NanoGoner (26) | |||
|
I have had several problems with pthread.h. The latest is a definition conflict. The code is:
There are numerous other files. The compiler error is: -------------------------------------------------------------------------- /home/bruce/Desktop/main.c|26|warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]|\ /usr/include/pthread.h|225|note: expected ‘void * (*)(void *)’ but argument is of type ‘void * (*)(unsigned char (*)[8])’| ||=== Build finished: 1 errors, 8 warnings ===| --------------------------------------------------------------------------- The definition in conflict in pthread.h is: --------------------------------------------------------------------------- /* Create a new thread, starting with execution of START-ROUTINE getting passed ARG. Creation attributed come from ATTR. The new handle is stored in *NEWTHREAD. */ extern int pthread_create (pthread_t *__restrict __newthread, __const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *),// <--problem rea void *__restrict __arg) __THROWNL __nonnull ((1, 3)); -------------------------------------------------------------------------------- It seems to say that the arguement " void*(*_start_routine) (void*) " refers to my initiation function void *control_updater (unsigned char rs232_control[10][10]); The function definition in pthread.h seems to match the start_routine I've described, but the error message seems to find fault with the arguement for the function. Can anyone find my oversight? | |||
|
|
|||
| kbw (5520) | |||
You can't change the prototype of a thread entry point. You have to cast.
| |||
|
|
|||
| NanoGoner (26) | |
|
I presume that the *rs232 should have been *rs232_control. In any case, I tried both implimentations and got the same error message as before. The casting doesn't seem to have changed anything. | |
|
|
|
| ne555 (4383) | |||
|
You did change the prototype too, ¿right? As I already tell you,
Also, look at line 36. | |||
|
|
|||
| NanoGoner (26) | |||
|
I'm reposting the code to incorporate the suggestions so far. I've also changed variable names to better reflect the test application for the intended code.
All current suggestions result in the same declaration error | |||
|
Last edited on
|
|||
| ne555 (4383) | |||
You are not listening.
| |||
|
|
|||
| NanoGoner (26) | |
| The variable rs_cube[8][8] is loaded in the various "effect..." routines. When it is loaded, the thread picks it up and delivers it to cube_updater() otherwise I must not be understanding something. Even if that weren't the case, I don't understand why that would stand in the way of compiling and linking. | |
|
|
|