I am working in an applpication in c++ in Linux, basically what I want to do is this, I have two .cpp files one of them is main.cpp which use threads. My problem is that I tried to make an executable like this:
g++ -c main.cpp -> I get main.o
g++ -c second.cpp -> I get second.o
g++ -o executable main.o second.o
-> I get : 2ficheros.cpp:(.text+0xa4): undefined reference to `pthread_create'
SO I guess that my mistake is because I have to associate the pthread library in same way but I do not have idea how to do it. I was looking on internet and I find that I have to do something like this : g++ -o executable main.o second.o pthread.o
but I do not know if it is correct and I cannot see the pthread.o just the pthread.h.
Sorry if I am speaking without knowledges, if someone can help me please.