0

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?

2
Contributors
3
Replies
15
Views
4 Years
Discussion Span
Last Post by Ancient Dragon
1

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>

0

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!

1

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.