Error pthread_id_np_t undeclared

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seforo
    New Member
    • Nov 2006
    • 60

    Error pthread_id_np_t undeclared

    Dear team,

    I am using posix thread and I downloaded example that I want to test. However the compile complains that:
    `pthread_id_np_ t' was not declared in this scope

    I have done:
    #include <pthread.h>
    and I compile as follow:

    g++ -pthread example.cxx

    How I can solve this problem?
  • mohammadazim
    New Member
    • Aug 2007
    • 28

    #2
    Originally posted by seforo
    Dear team,

    I am using posix thread and I downloaded example that I want to test. However the compile complains that:
    `pthread_id_np_ t' was not declared in this scope

    I have done:
    #include <pthread.h>
    and I compile as follow:

    g++ -pthread example.cxx

    How I can solve this problem?
    if you want to use thread then you can use pthread_t instead of `pthread_id_np_ t'. Then do a pthread_create to create it.

    instead downloading some code try downloading some tute and try yourself.

    Secondly, while specifing pthread library while compiling it should be -lpthread. That is -l<libname>. Or if you are on Ubunto or some other platform that don't need 'l' to identify a library then it is fine.

    Comment

    • seforo
      New Member
      • Nov 2006
      • 60

      #3
      First of all I know how to use pthread_t and I want to know why the compiler does not recognize pthread_id_np_t .
      Secondly there is some import behavior I want to observe from that code and reuse it. I don't have to reinvent the wheel.
      Thirdly posix thread are compiled with -pthread (http://www.llnl.gov/computing/tutorials/pthreads/)

      Comment

      • mohammadazim
        New Member
        • Aug 2007
        • 28

        #4
        Originally posted by seforo
        First of all I know how to use pthread_t and I want to know why the compiler does not recognize pthread_id_np_t .
        Secondly there is some import behavior I want to observe from that code and reuse it. I don't have to reinvent the wheel.
        Thirdly posix thread are compiled with -pthread (http://www.llnl.gov/computing/tutorials/pthreads/)
        Sorry I thought you never used pthread.

        Here is valuable quote that I found on http://publib.boulder.ibm.com/infoce...s/users_23.htm

        "The i5/OS machine implementation of threads provides a 64-bit thread ID. The thread ID is returned as a structure containing the high and low order 4 bytes of the 64-bit ID. This allows applications created by compilers that do not yet support 64-bit integral values to effectively use the 64-bit thread ID.
        "

        May be it is our platform which do not support pthread_id_np_t and saw pthread.h and other headers in /usr/include/ and this pthread_id_np_t is no where declared.

        I wrote a simple code including pthread.h and tried to use pthread_id_np_t and it gave me the same error.

        Comment

        Working...