1

I have included vsprintf in my project. However, when I compile it I receive the following error.

/opt/xgcc/decstation-ultrix/bin/xgcc -DIN_USER_MODE -c -I../userprog -I../threads -G 0 -Wall -O2 -DCHANGED -c vsprintf.c
vsprintf.c:12: stdarg.h: No such file or directory
make[1]: *** [vsprintf.o] Error 1
rm add.o
make[1]: Leaving directory `/home/banana/se31/code/test'
make: *** [all] Error 2

Line 12 of vsprintf contains the following:

#include <stdarg.h>

I verified that stdarg.h is properly installed in my system using the following short programs.

//test.c and test.cpp
#include <stdarg.h>

int main(void)
{
   return 0;
}

When I run gcc test.c or gcc test.cpp I receive no errors which implies that my vsprint.c and gcc is properly installed.

I have gone through similar questions in stackoverflow but have not got a solution yet. I am using Ubuntu 32 bit as my Operating System. Could someone guide me on how I can resolve this issue?

Adwin
  • 195
  • 2
  • 6
  • 21
  • 1
    "When I run gcc test.c or gcc test.cpp I receive no errors" -- But it's not gcc that's giving you errors in the first place, so there's no point in checking that. The error is given by `/opt/xgcc/decstation-ultrix/bin/xgcc`. –  Nov 17 '15 at 20:26
  • xgcc uses features from gcc and g++ and translates it to mips. Am working on a project for a mini operating system called [link](https://homes.cs.washington.edu/~tom/nachos/). I am using NACHOS' cross compiler for linux [link](https://www.student.cs.uwaterloo.ca/~cs350/common/linux-nachos.html). The compiler depends on gcc as well as g++. That is why I was testing gcc. – Adwin Nov 17 '15 at 20:42
  • 1
    "xgcc uses features from gcc and g++ and translates it to mips." -- No, it doesn't. It doesn't use features from your host's gcc, it's a separate standalone sort-of-installation of a specially configured gcc, and in fact if it would use your host's header files, things would break badly, as your host's header files are not written for mips. –  Nov 17 '15 at 20:51
  • You are right I am to work with the xgcc cross compiler and not the system wide gcc. This has been fixed by including the stdarg.h file and recompiling xgcc. Thank you... – Adwin Nov 19 '15 at 13:01

1 Answers1

0

As hvd

pointed out. I was checking for stdarg.h in the wrong place. To fix it, stdarg.h had to be added to my project. From there, the cross compiler (xgcc) was able to compile the program.

Community
  • 1
  • 1
Adwin
  • 195
  • 2
  • 6
  • 21