Q:

Including a header with code::blocks

So, I've created a C project in Code::blocks. In the beginning it contains only main.c file. Then I've added a c++ class (gobject c) for dividing a project into src and include folders, then i changed extension in cpp file to c.
When I try to compile it gives me a message:
fatal error: /home/user/Project_name/src/A.h: No such file or directory

So, class name is A:

Path for the header : include/A.h
Path for the definition : src/A.c

Code for A.c (I've tried include "/include/A.h" and include "include/A.h" but without result)
#include "A.h"

Code for A.h
#ifndef A_H
#define A_H

#endif

How can i solve this problem? Also I've tried to include A.h in main.c (without result :( )

A:

When you include a file in C, the C preprocessor by default can search in 2 places:
1) #include <stdlib.h> - the stdlib.h is searched for in the compiler's include search path
2) #include "myLib.h" - the myLib.h is searched for in the current directory (unless you traverse the directories)
You should try doing #include "../include/A.h" inside of the src/A.c.

