In C++ (as well as in C) there is a difference between declaring and defining things like variables. What you are doing in the header file is defining the variables, which means that every source file that includes the header file will have the definitions.
In the header file you should only declare the variables, and then in a single source file define them.
So in the header file do e.g.
extern pthread_mutex_t set_queue_mutex;
extern pthread_cond_t condition_var;
extern std::queue<int> q;
And then in a single source file put the definitions (what you have now).