I met error pintos/src/userprog/build/../../userprog/syscall.c:56: undefined reference to `exit'
while working on a pintos project.
Below is part of directory tree that is related with error.
-lib
-user
-syscall.c
-syscall.h
-userprog
-syscall.c
(lib and userprog have same hierarchy.)
In userprog/syscall.c, The function exit is well-defined on both header file and c file.
// lib/user/syscall.c
void
exit (int status)
{
syscall1 (SYS_EXIT, status);
NOT_REACHED ();
}
// lib/user/syscall.h
void exit (int status) NO_RETURN;
But When I call exit on userprog/syscall.c
, I meet error undefined refrence to 'exit'
I includede syscall.h in lib/user/ as #include "lib/user/syscall.h"
// userprog/syscall.c
#include "lib/user/syscall.h"
void
foo()
{
...
exit(-1);
}
What would be the problem?