I am having problems compiling this code for cpu synchronization using threads. An error says that the "ou_thread" directory does not exist

#include <STRING>
using namespace std;
#include "ou_thread.h"
using namespace openutils;

class MyThread : public Thread {
private:
    int m_nCount;
public:
    MyThread(int n,const char* nm) {
        Thread::setName(nm);
        m_nCount = n;
    }
    void run() {
        for(int i=0;i<m_nCount;i++) {
            cout << getName().c_str() << ":" << i << endl;
        }
    }
};

int main() {
    Thread *t1 = new MyThread(15,"Thread 01");
    Thread *t2 = new MyThread(10,"Thread 02");
    try {
        t1->start();
        t2->start();
        t1->stop();
        t2->stop();
    }catch(ThreadException ex) {
      printf("%s\n",ex.getMessage().c_str());
  } 
  delete t1;
  delete t2;
  return 0;

I assume you are using some IDE, in it there will be a field for additional includes directories, add the directory that contans your header to that field., if you are compiling from the command line its -i<dir> for gcc (off the top of my head)

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.