Archived

This topic is now archived and is closed to further replies.

Sir Valeq

waitpid and g++

Recommended Posts

Hi! Do you have any idea why ''waitpid'' is an undeclared identifier when I compile a *.cpp file with g++ and it compiles fine when there''s a *.c file and gcc? Are there any special includes for c++ to get waitpid working? Thanks -------------- "We cannot all be masters." - William Shakespeare

Share this post


Link to post
Share on other sites
Usually a man ''call name'' will return the necessary includes.

OS X man waitpid:

#include <sys/types.h>
#include <sys/wait.h>

If you check that and it still doesn''t work...hrms....

Int.

Share this post


Link to post
Share on other sites
ONLY if you get undefined symbols after doing the above, then enclose those includes in extern "C"

but most headers should do this automatically.

Share this post


Link to post
Share on other sites
Hehe, of course, I did include those headers.
Now I''ll try with extern "C".
I hope it''ll help.
Thanks

--------------
"We cannot all be masters." - William Shakespeare

Share this post


Link to post
Share on other sites
quote:
Original post by Sir Valeq
I hope it''ll help.


Actually, given what you''ve said, it shouldn''t. You have a compile time error (undeclared identifier) mine fixes a link time error (undefined symbol)

Share this post


Link to post
Share on other sites
Then what should I do? Use a different compiler? Which one?

--------------
"We cannot all be masters." - William Shakespeare

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
reduce it to a small 10 line .cc file that gets you the error, and show us that file ,adn the exact error (heck, all the compiler output) for that smaller file.

Share this post


Link to post
Share on other sites