Another "Undefined Reference to..."
I cannot for the life of my figure this out, probably have been staring at it too long. I have been getting this error
Code:
main.c:(.text+0x90): undefined reference to `lreceive'
Here is what I typically use to compile it:
Code:
gcc -o a main.c linsock.c -Wall -pthread -pedantic
I also tried compiling both of them into separate object files and then linking them, but to no avail...
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
Code:
pthread_create(&(info.tid), NULL, lreceive, (void *)&info);
linsock.c
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;
}
Any words of wisdom?