0

I'm currently trying to compile my file traceroutet.c through a virtual machine running Ubuntu, which I think is causing the problem. I'm also accessing files through my university's VPN, could that cause issues?

Whenever I try to compile through the vm's terminal using gcc -o traceroutet traceroutet.c I get this error:

traceroutet.c:13:16: fatal error: ip.h: No such file or directory

compilation terminated

The thing is, my header files are saved in the same folder as my source, so I thought gcc -o would work here? I've also tried using -I/h/SCC203/Lab 2/ip.c when compiling too, but I get a similar error.

I've been using gcc a while now and never had a problem with it, so I'm guessing this is something to do with the virtual machine or VPN?

JmJ
  • 1,989
  • 3
  • 29
  • 51
  • `-I/h/SCC203/Lab 2/ip.c` is wrong anyway: it contains a space, and the space must be escaped, like `-I/h/SCC203/Lab\ 2` (is `ip.c` REALLY a name of directory that contains ip.h?) Anyway, it would help if you show us your #include directive. – nullptr Nov 27 '13 at 22:57
  • Thanks for telling me how to escape the space. Yeah, and I've tried it as ip.c and ip.h – JmJ Nov 27 '13 at 23:00

1 Answers1

1

I doubt very much that the error is related to the virtual machine.

I think it depends on how you #include your ip.h: if you write #include "ip.h" (note the double quotes), then you make the compiler to look for 'ip.h' located in the same directory as the .c file. It's implementation-defined whether the compiler would continue searching among the system headers. Since you are most likely trying to include a system-wide ip.h and not your own IP-related header file, you should include it with angle brackets (and with the correct relative path): #include <linux/ip.h>.

nullptr
  • 11,008
  • 1
  • 23
  • 18
  • Thank you! adding `linux/` in the `#include` statement made all the difference! – JmJ Nov 27 '13 at 23:01