Question

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?

Was it helpful?

Solution

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>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top