Answer the question
In order to leave comments, you need to log in
`
Error undefined reference to `pthread_create'. How to fix?
KDevelop fails to build a program with a stream.
The module is connected The
thread is called
When trying to build, I get the following error:thread mythr(myfunc2);
/home/evg/projects/myprog2/build> make -j1 -lpthread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/evg/projects/myprog2/build
[ 50%] Linking CXX executable myprog2
CMakeFiles/myprog2.dir/main.cpp.o: In function `std::thread::thread(void (&)())':
/usr/include/c++/7/thread:122: undefined reference to ` pthread_create'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/myprog2.dir/build.make:95: myprog2] Error 1
make[1]: *** [CMakeFiles/Makefile2:68 : CMakeFiles/myprog2.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
*** Error: Exit code: 2 ***
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question