Pthread_create Error 251
explicitly in link path, I face anotherproblem where call to 'cout' is aborting. [cout is NOT inside thethread]Any help is appriciated.-Sameer-------------------------------------------------------------------In both cases sources were compiled with optionCCFLAGS = +w -AA -ext -I. +Z -z +inline_level 3 +inst_compiletime +p+DA2.0W-D_POSIX_C_SOURCE=199506L -DO=11.11+ESlit-D_REENTRANT -D_LARGEFILE_SOURCE -D_HPUX_SOURCE -DHPUX-DURFLOG -DXML -DHP -DNEWAUDIT -DHP-I/myhome/include -I/opt/aCC/include_std-mt -g-I/usr/include -c qsrv.cpp -o qsrv.oCASE I :'ldd' out put when pthread_create is failng, but 'cout' are workingok.$gror> ldd qsrvlibc.2 => /usr/lib/pa20_64/libc.2libxerces-c.sl.25 => /myhom/slib/libxerces-c.sl.25libsanitydAPI.sl => /myhome/slib/libsanitydAPI.sllibcnfgaccess.sl => /myhome/slib/libcnfgaccess.sllibcfgdata.sl => /myhome/slib/libcfgdata.sllibdalXml.sl => /myhomeslib/libdalXml.sllibcomnew.sl => /myhome/slib/libcomnew.sllibxml2.sl.7 => /myhome/slib/libxml2.sl.7libstd_v2.2 => /usr/lib/pa20_64/libstd_v2.2libCsup_v2.2 => /usr/lib/pa20_64/libCsup_v2.2libstd.2 => /usr/lib/pa20_64/libstd.2libstream.2 => /usr/lib/pa20_64/libstream.2libCsup.2 => /usr/lib/pa20_64/libCsup.2libpthread.1 => /usr/lib/pa20_64/libpthread.1libm.2 => /usr/lib/pa20_64/libm.2libcl.2 => /usr/lib/pa20_64/libcl.2libdl.1 => /usr/lib/pa20_64/libdl.1libdl.1 => /usr/lib/pa20_64/libdl.1libpthread.1 => /lib/pa20_64/libpthread.1libnsl.1 => /lib/pa20_64/libnsl.1libm.2 => /lib/pa20_64/libm.2libc.2 => /lib/pa20_64/libc.2libdl.1 => /usr/lib/pa20_64/libdl.1libxti.2 => /usr/lib/pa20_64/libxti.2Link command and options./opt/aCC/bin/aCC -Wl,+n,+k,-z+DA2.0W -D_POSIX_C_SOURCE=199506L -D_REENTRANT-D_LARGEFILE_SOURCE-mt-L/myhome/slibqsrv.o queryThread.o-l-lc -l-L/opt/aCC/lib -L/usr/lib/pa20_64 -lstd_v2 -lCsup_v2-o qsrvCASE II:The ldd for lin
Programming Boards C Programming pthread_create() Problem.. Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: pthread_create() Problem.. Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 09-20-2006 #1 anwar_pat View Profile View Forum Posts Registered User Join Date Feb 2006 Posts 22 pthread_create() Problem.. Hi All, i am getting the following error while compiling the program : ERROR; return code from pthread_create() is 251 Is anyone have idea what could be the reason or when error http://comp.sys.hp.hpux.narkive.com/VmfkDB2i/pthread-create-error-251-and-cout-aborting number 251 is coming ? following the loop where i m calling the pthread_create function. for(t=0;thttp://cboard.cprogramming.com/c-programming/83228-pthread_create-problem.html ? My source indicates that error 251 appears to be Code: #define ENOSYS 251 /* Function not implemented */ although I can't confirm this. I don't have a POSIX threads library. 09-21-2006 #3 anwar_pat View Profile View Forum Posts Registered User Join Date Feb 2006 Posts 22 thnx a lot . i was nt using -lpthread while compiling.Now its running fine. Quick Navigation C Programming Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums General Programming Boards C++ Programming C Programming C# Programming Game Programming Networking/Device Communication FAQ Board Programming Book and Product Reviews Platform Specific Boards Windows Programming Linux Programming Cprogramming.com and AIHorizon.com's Artificial Intelligence Boards General AI Programming Community Boards Article Discussions Tech Board General Discussions A Brief History of Cprogramming.com Contests Board Projects and Job Recruitment « Previous Thread | Next Thread » Popular pages Exactly how to get started with C++ (or C) today C Tutorial C++ Tutorial 5 ways you can learn to program faster The 5 Most Common Problems New Programmers Face How to set up a compiler 8 Common programming Mistakes What is C++11? Creating a game, from start to finish Recent additions How to create a shared library on Linux with GCC - December 30, 2011 Enum classes and nullptr in C++11 - November 27, 2011 Learn about
reply to: Sameer Rele: "pthread_create error 251 and cout aborting" Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] http://unix.derkeiler.com/Newsgroups/comp.sys.hp.hpux/2004-08/0191.html Date: Thu, 19 Aug 2004 23:22:06 GMT Sameer Rele wrote: |I was getting error for pthread_create() with error code [NOSYS]. When |I added -lpthread library explicitly in link path, I face another |problem where call to 'cout' is aborting. [cout is NOT inside the |thread] | |Any help is appriciated. ... |Link command and options. pthread_create error |/opt/aCC/bin/aCC -Wl,+n,+k,-z | +DA2.0W -D_POSIX_C_SOURCE=199506L -D_REENTRANT |-D_LARGEFILE_SOURCE | -mt | -L/myhome/slib | qsrv.o queryThread.o | -lpthread | -l | -lc -l | -L/opt/aCC/lib -L/usr/lib/pa20_64 -lstd_v2 -lCsup_v2 | -o qsrv You should compile with something like this. /opt/aCC/bin/aCC +DA2.0W -D_LARGEFILE_SOURCE -mt +z -c some.cxx You should link with pthread_create error 251 something more like this. opt/aCC/bin/aCC -Wl,+n,+k,-z +DA2.0W -mt -L/myhome/slib qsrv.o queryThread.o -l -l -o qsrv The -mt option takes care of the -D_POSIX_C_SOURCE=199506L when compiling. The -mt option also takes care of linking with the pthread library. aCC takes care of linking in the right aCC runtime libraries and libc. Your current error is caused by having linked in both the -AA and -AP versions of the c++ runtime libraries. You can see that because both libstd and libstd_v2 show up in the ldd output. You need to consistently compile and link with the -AA option or without the -AA option. When you compile with -AA the code expects the *_v2 libraries. When you link with -AA aCC will link in the *_v2 versions. -- Mike Stroyan, mike.stroyan@hp.com Next message: Alan D Johnson: "Re: has this bug been fixed?" Previous message: Xavier Maillard: "BIND-920 and "chroot"" In reply to: Sameer Rele: "pthread_create error 251 and cout aborting" Messa