tags:

views:

141

answers:

3

I'm using a header called colors.h to organize my source code. The header is like this:

#define DEFAULT 0x07
#define BLACK 0
#define GRAY 7
#define BLUE 9
#define GREEN 10
#define CYAN 11
#define RED 12
#define MAGENTA 13
#define YELLOW 14

I'm putting the header at the same directory of the main source code, called kernel.c, and including it like this:

#include <colors.h>

But when I try to compile, I'm getting this:

ubuntu@eeepc:~/Development/Test$ gcc -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs
kernel.c:1:20: error: colors.h: No such file or directory
ubuntu@eeepc:~/Development/Test$

What I can do to solve this?

+9  A: 

Use quotes:

#include "colors.h"

Using quotes will look in the same directory first, and then in the specified include paths. Using angle brackets will look in the include paths only.

interjay
A: 
#include "colors.h"
Maurits Rijk
+1  A: 

Angle brackets are used to find a header in the implicit header paths. Headers in explicit paths, including the current directory, need quotes.

Ignacio Vazquez-Abrams