Hello! I have in my workspace 3 projects, two - console applications (Ubuntu14.04. GCC), and common library - static now.
The library uses pthreads, implementing wrappers for multitasking... when i make library - all is ok... but when i make any of my console apps - it finishes with error - "undefined reference to `pthread_create'"...which hints that pthread code is not linked into my library.
internet speaks a lot about this issue, and recommends to add -lpthread option to gcc options... but add it after a list of object files... but "compiler additional options" adds new options before object files list... (it i added -lpthread there, problem is not solved)...
So i m searching a way to easy add compiler options after object files list.
Regards, Alex
Stucking with pthreads
-
- CodeLite Curious
- Posts: 7
- Joined: Sun Jul 13, 2014 10:20 am
- Genuine User: Yes
- IDE Question: c++
- Contact:
Stucking with pthreads
Ubuntu 14.04, Codelite, GCC
-
- CodeLite Curious
- Posts: 7
- Joined: Sun Jul 13, 2014 10:20 am
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: Stucking with pthreads
Ahh! problem solved... i just need to add additional -lpthread option to Linker! not to compiler.
At least my problem, easy to be solved will be useful for some novices.
Regards Alex.
At least my problem, easy to be solved will be useful for some novices.
Regards Alex.
Ubuntu 14.04, Codelite, GCC
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Stucking with pthreads
First, this is not a codelite issue, but a general C/C++ issue.
to your executables projects
Right click on the project settings (of the console applications)->settings->linker->libraries and type
Eran
A library does not get "linked", you can think of a static library as an archive of objects - thats itmerk666 wrote:which hints that pthread code is not linked into my library
You need to addmerk666 wrote:internet speaks a lot about this issue, and recommends to add -lpthread option to gcc options... but add it after a list of object files... but "compiler additional options" adds new options before object files list... (it i added -lpthread there, problem is not solved)...
So i m searching a way to easy add compiler options after object files list.
Regards, Alex
Code: Select all
pthread
Right click on the project settings (of the console applications)->settings->linker->libraries and type
Code: Select all
pthread
Make sure you have read the HOW TO POST thread