Results 1 to 6 of 6

Thread: pthread error macro declaration (c++)

  1. #1
    Join Date
    Jun 2009
    Location
    melbourne
    Beans
    13
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    pthread error macro declaration (c++)

    Sorry to ask a beginner question. Why i get undeclared error declaration, and i don't see any error macro declaration in pthread.h.

    Code:
    #include <pthread.h>
    ...
    
    int status = pthread_cond_timedwait(&cond, &mutex);
    if(status != 0 && status != ETIMEDOUT) // ETIMEDOUT not declared compile-error
    ...
    The same code is compilable and run on mingw and pthread-win32.
    GCC version is 4.4.1.

  2. #2
    Join Date
    Dec 2009
    Beans
    82

    Re: pthread error macro declaration (c++)

    type gcc -v to see the version you are compiling under.

    I assume you are compiling on gcc 4.4.1 on a Ubuntu.

    It is assuming something is undefined in your code, so the first thing is to start checking versions of the libraries under gcc and or if all the libraries are there.

  3. #3
    Join Date
    Jun 2009
    Location
    melbourne
    Beans
    13
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: pthread error macro declaration (c++)

    so i run getconf GNU_LIBPTHREAD_VERSION
    and it says NPTL 2.10.1

    or how do I check for the library version? may be the one that is used by GCC and the one that used by my system is different.

  4. #4
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,285
    Distro
    Kubuntu

    Re: pthread error macro declaration (c++)

    Error types (macro definitions) such as the one you have listed are typically available if you include <cerrno>, or <errno.h> in C.

  5. #5
    Join Date
    Jun 2009
    Location
    melbourne
    Beans
    13
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: pthread error macro declaration (c++) [solved]

    thx dude. Works like charm!

  6. #6
    Join Date
    Feb 2012
    Beans
    1

    Smile Re: pthread error macro declaration (c++)

    Thanks !

    It's <errno.h> in C for add ETIMEDOUT


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •