0

I have written a program in C using GTK3 version 3.24 on a Raspberry Pi. There are several buttons in the application.

When I click one particular button, I want to launch a thread that will output a number of pulses on a pin of the Raspberry Pi. It shall be possible to stop the outputting of pulses by clicking another button at any time. I use pigpio for control of the pin. Hence I have an 'on_execute_clicked' button function to launch a pthread, but the compilation fails with the message:

/usr/bin/ld: main.o: undefined reference to symbol 'pthread_create@@GLIBC_2.4'

I have the statement #include <pthread.h> in my source file.

What am I doing wrong?

Is it not possible to use pthread in a GTK3 program?

How may I get a "function" to execute in the background?

Regards, Jorgen

PS. the g_thread is not available in GTK3 version 3.24

Jorgen Sandberg
  • 421
  • 1
  • 4
  • 3
  • 1
    Does this answer your question? [Undefined reference to pthread\_create in Linux](https://stackoverflow.com/questions/1662909/undefined-reference-to-pthread-create-in-linux) – kaylum Jan 07 '22 at 10:51
  • Sorry, I found a mistake in the Makefile, but do I use the best solution to my problem? – Jorgen Sandberg Jan 07 '22 at 11:10

0 Answers0