468,496 Members | 1,804 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,496 developers. It's quick & easy.

Error pthread_id_np_t undeclared

60
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?
Nov 22 '07 #1
3 10502
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.
Nov 22 '07 #2
seforo
60
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/)
Nov 22 '07 #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/)
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.
Nov 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Materialised | last post: by
13 posts views Thread by developer | last post: by
5 posts views Thread by cranium.2003 | last post: by
4 posts views Thread by Jon Rea | last post: by
1 post views Thread by jrefran | last post: by
25 posts views Thread by notahipee | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.