Results 1 to 1 of 1
Hello,
I have a problem with the declaration of a function.
This is how I declare the function :
c:63: void foo(threadpool *tp,void (*func)(void*), (void*)arg);
Inside main, I call it ...
- 12-22-2010 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 1
emergency - declaration problem!
Hello,
I have a problem with the declaration of a function.
This is how I declare the function :
c:63: void foo(threadpool *tp,void (*func)(void*), (void*)arg);
Inside main, I call it like this:
main(){
..........
threadpool y;
c:104: foo(y,foo2,(void*)x);
}
and here is the foo2,and foo:
c:109:void foo(threadpool *tp,void (*func)(void*), (void*)arg){.........}
c:110: void * foo2(void *arg) {......}
gcc gives me those things:
c:63: error: expected declaration specifiers or ‘...’ before ‘(’ token
c:104: warning: passing argument 2 of ‘foo’ from incompatible pointer type
c:63: note: expected ‘void (*)(void *)’ but argument is of type ‘void * (*)(void *)’
c:104: error: too many arguments to function ‘foo’
c:110: error: expected declaration specifiers or ‘...’ before ‘(’ token
c:110: error: expected identifier or ‘(’ before ‘{’ token
Generally,foo is a function used to access a threadpool and takes a thread , passes to it the function foo2 to execute it.
I dont know what the problem is,even if I tried a lot of things.Please answer as soon as possimple because i m pressed in time!
thanks in advance


Reply With Quote