classes gives errors

Jul 26, 2013 at 5:57am
hi guys i m new at linux programing actually new at programing and i have a problem.

at windows #include "myclass.h" wasnt giving any errors but in linux(i use ubuntu) i m having this error
1
2
fatal error: birthday.h: No such file or directory|
||=== Build finished: 1 errors, 0 warnings ===|


after i changed it to this "include/myclass.h" i dont get any error.

and here is the problem what should i do if i need to reach a class from another class.
"birthday.cpp" is in kk/src folder and "birthday.h" is in kk/include folder and "main.cpp" is in kk folder. it is not giving errors if i try to reach birthday.h from main.cpp. But from any class(all classes's cpps r in kk/src folder) it gives this error
1
2
fatal error: include/birthday.h: No such file or directory|
||=== Build finished: 1 errors, 0 warnings ===|

it was very long. hope u guys can help me i know it is very simple but cant find the solution

and if it is needed Linux CesetPC 3.10.3-031003-generic #201307251835

Thank you all in advance
Last edited on Jul 26, 2013 at 5:58am
Jul 26, 2013 at 6:04am
closed account (Dy7SLyTq)
you need to do some more research on paths. for the non-main.cpp files, make it either an absolute path or "../include/whateverfile.h"
Jul 26, 2013 at 6:13am
ty DTSCode i just used ../ and it went perfect. ty again
Jul 26, 2013 at 6:20am
closed account (Dy7SLyTq)
np. but i would seriously do some more research on file paths, because not to be mean (but i am speaking the truth), you have a fundamental gap. that should be easy. i would start with this: http://en.wikipedia.org/wiki/Path_(computing)
it looks promising
Aug 11, 2013 at 11:03am
might be because instead of learning com. i started from programming. whatever thx again
Aug 11, 2013 at 6:25pm
man gcc wrote:
-Idir
Add the directory dir to the head of the list of directories to be
searched for header files.

that way you don't have to worry about where is your source file located.
Aug 11, 2013 at 6:28pm
closed account (Dy7SLyTq)
i know that was meant for ceset, but thanks ne555. that will make my compilation cleaner. i didnt know about that
Topic archived. No new replies allowed.