3

I call the function phtread_kill(gpsNavigationThread, 0) and ge the following error

Undefined symbols for architecture x86_64:

"_phtread_kill", referenced from:
  _startgpswatchdog in ccXXNhjy.o
ld: symbol(s) not found for architecture x86_64

I #include <pthread.h> so am not sure what the issue is.

I link as follows

gcc gps_nav.c dijk.c serial.c parser.c nav_corelogic.c -I/usr/include/libxml2 -lxml2 -lm -lpthread -o logic

I also #include signal.h but am not sure if there is a library for linking with it.

some_id
  • 29,466
  • 62
  • 182
  • 304
  • are you compiling with specific -m flags? -m32 or -m64 ? – ShinTakezou Apr 23 '11 at 17:00
  • No. I use the statement above – some_id Apr 23 '11 at 17:08
  • What OS? I think people are assuming Linux, but modern Linux-based systems do not use underscore prefix for C symbol names. Perhaps you're mixing binary code intended for another OS? – R.. GitHub STOP HELPING ICE Apr 23 '11 at 17:09
  • @Helium3 sorry I had not seen it; and what about specifying one of -m32 or -m64, just to see if it is just a problem you are compiling in one way but the lib is available only as 32 or 64 bit... (afaik you cannot mix the thing in the same executable) – ShinTakezou Apr 23 '11 at 17:28
  • there's a typo!! (brain is able to autosort letters in wrong position in known words, so it can be missed, this is a proof of that!) – ShinTakezou Apr 23 '11 at 17:30

4 Answers4

9

It's

pthread_kill(gpsNavigationThread, 0)

not:

phtread_kill(gpsNavigationThread, 0)
karlphillip
  • 92,053
  • 36
  • 243
  • 426
0

Have you linked with the pthreads library: -lpthread

Tom Wadley
  • 121,983
  • 1
  • 26
  • 29
0

Did you compile with -lpthread ?

Henno Brandsma
  • 2,116
  • 11
  • 12
0

Try the -pthread option, which should set the appropriate options for both compilation and linking.

Douglas Leeder
  • 52,368
  • 9
  • 94
  • 137