Compiling vala with cmake: `Undefined reference to 'g_thread_init``

I am new to vala and I am trying to create something with CMAKE. However, towards the end, he throws undefined reference to 'g_thread_init' . I added --thread to the OPTIONS part of ValaPrecompile. I also tried adding pkg_check_modules(DEPS REQUIRED gthread-2.0) and add_definitions(${CFLAGS} -lgthread-2.0 ) , but no luck.

The output of pkg-config --libs gthread-2.0 :

 -pthread -lgthread-2.0 -lrt -lglib-2.0 

Any ideas?

+4
source share
1 answer

There may be other solutions, but what I did for the same problem was as follows:

 target_link_libraries(myTarget ${LIBRARIES} gthread-2.0) 

Where myTarget is your target binary and LIBRARIES is your list of other libraries.

+4
source

Source: https://habr.com/ru/post/1498762/


All Articles