0

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;
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Kanoisa
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

Edited by Kanoisa: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.