Registered Member
|
Hi.
I'm having a problem with threads in KDevelop and I'd appreciate any help. This may sound like a dumb question to you, but please be patient, for I'm neither an expert in KDevelop, nor in C++, nor in Ubuntu. I'm trying to run a C++ program that involves threads in KDevelop 4.3.1, but I get this error: undefined reference to `pthread_create'. I'm using Ubuntu 12.04 LTS. As far as I know, I'm getting that error because I haven't added the pthread library to my project (I did include the header), but I don't know where to do this. This is my code:
So my question is: where do I add the pthread library to my project or where do I add some kind of argument (-lpthread, I'm guessing) to my project? Thanks in advance. Regards. |
Global Moderator
|
Hello!
How you do this depends on your build system (and is thus not really related to KDevelop). If you're using cmake, you should be able to solve this by putting something like this into your CMakeLists.txt:
(I didn't test that, tough ;P) If you want to add plain flags, you can also do target_link_libraries(myapp pthread), but that's a bit dirty. Greetings, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
Thanks! I tried the first option and it worked great. Thanks a lot, again. Regards. |
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]