Hey guys I'm having trouble declaring a header file so I can use multiple modules. I have files named main.c
foo.h
and in main.c I have a <#include foo.h> but it says that it can't find the foo.h file. Why?
Hey guys I'm having trouble declaring a header file so I can use multiple modules. I have files named main.c
foo.h
and in main.c I have a <#include foo.h> but it says that it can't find the foo.h file. Why?
wrong, no angle brackets < and > and put the filename in quotes.
#include "foo.h"
If you want to include a standard compiler header file then it's like this:
#include <stdio.h>
I had that in my notes, with quots and not brackets. I just didn't remember that it was suppose to be literal haha. THANKS!
There is no standard way of doing it, some compilers want quotes for your own headers, while other compilers will accept angle brackets. You need to read the documentation for the compiler you are using to find out how it want it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.