I cannot for the life of my figure this out, probably have been staring at it too long. I have been getting this error
Here is what I typically use to compile it:Code:main.c:(.text+0x90): undefined reference to `lreceive'
I also tried compiling both of them into separate object files and then linking them, but to no avail...Code:gcc -o a main.c linsock.c -Wall -pthread -pedantic
What I am doing is creating a thread, but the function the thread uses is in another source file. Would that make a difference?
main.c
linsock.cCode:pthread_create(&(info.tid), NULL, lreceive, (void *)&info);
Any words of wisdom?Code:void *lreceive (void *params) { struct linfo *info = (struct *linfo)params; int result = 1; char *buffer = malloc(2048 * sizeof(char)); while (result) { result = recv(info->fsock, buffer, 2048, 0); if (result) { printf("%d bytes received\n"); } else break; } return NULL; }



LinkBack URL
About LinkBacks



