Safe Quit issue resolved along with the linker problem
Earlier the program wasn't exiting normally and since the AI.h file was named as AI.c, this lead a problem with the linker at the time of compilation. But these issues are dealt with by adding a goto statement to safely exit and by doing the necessary changes with the file name.