Moello
Moello

Reputation: 3

GCC error No such file or directory when including a separate file

When I try to compile including the file stack.h my GCC gives me the error "No such file or directory"

gcc -std=c99 -Wall -o Ou1 ou1.c -I C:\Users\NAME\Documents\C programmering\DOA\stack.h

The code looks like this:

#include <stdio.h>
#include <stdbool.h>
#include "stack.h"

I've tried to change its folder and changing the .h to .c and the .c to .h.

Upvotes: 0

Views: 4236

Answers (1)

Marco Bonelli
Marco Bonelli

Reputation: 69377

First, -I expects a path to a directory. Secondly, your path contains spaces, so you should enclose it in quotes to make sure it's not wrongly treated as two different arguments:

gcc -std=c99 -Wall -o Ou1 ou1.c -I "C:\Users\NAME\Documents\C programmering\DOA"

Upvotes: 2

Related Questions