4

を含むヘッダーファイルを含める際に問題が発生しましたsys/type.hg++またはを使用してコンパイルするgcc filename.cppと、常にエラーが表示されますsys/type.h, no such a file or directory。非常に混乱。誰かが私を助けることができますか?

#include<stdio.h>
#include<sys/type.h>
#include<unistd.h>

int main()
{

        pid_t child_pid;

        printf("the main program ID is %d\n", (int)getpid());

        child_pid = fork();

        if (child_pid != 0) {
                printf("This is the parent process, with id %d\n",
                       (int)getpid());
                printf("the child's process ID is %d\n", (int)child_pid);
        } else {
                printf("this is the child process, with id %d\n",
                       (int)getpid());
        }
}
4

1 に答える 1

6

<sys/types.h>'s'である必要があります

于 2012-06-01T23:42:21.530 に答える