c - Including a header with code::blocks -


so, i've created c project in code::blocks. in beginning contains main.c file. i've added c++ class (gobject c) dividing project src , include folders, changed extension in cpp file c.

when try compile gives me message:

fatal error: /home/user/project_name/src/a.h: no such file or directory 

so, class name a:

  • path header : include/a.h
  • path definition : src/a.c

code a.c (i've tried include "/include/a.h" , include "include/a.h" without result)

#include "a.h" 

code a.h

#ifndef a_h #define a_h  #endif 

how can solve problem? i've tried include a.h in main.c (without result :( )

when include file in c, c preprocessor default can search in 2 places:

1) #include <stdlib.h> - stdlib.h searched in compiler's include search path

2) #include "mylib.h" - mylib.h searched in current directory (unless traverse directories)

you should try doing #include "../include/a.h" inside of src/a.c.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -