Sorry for the title because I didn't find a proper name for it. My question is about POSIX functions, such as timer_create(), mq_open() and pthread_create().
If I put the above function in main.c, there will have no problem. The queue is successfully created. But if I put in a file, let say foo.c. This file is compiled into libFOO.a and linked with main.c. Then I got the following error: errno(2: No such file or directory)
The other POSIX functions are also same if put in libFOO.a, for example, timer_create() failed with "Invalid argument" errro, pthread_create() succeeds but it is never run.
Is there any difference between running in main.c and foo.c? If you ever experienced such problem then please give me some hints
I am working on embedded linux.
It turns out that the problem is not come from the source code itself but from the compile option. If I add -D_GNU_SOURCE when compiling libFOO then problem will be solved.
My problem comes from invalid compile option that I mentioned from my previous post. By the way, I tested with your code and get error code 11 returned from pthread_create() function. The meaning is "Resource temporarily unavailable". Do you have any idea?
I used MSVC2010 for testing your code (pthreadVC2.lib)