tags:

views:

53

answers:

2

Hi all, I'm quite new in C++ after few years in Java and eclipse, I got little bit confusing using code::blocks, no autogenerate setter/getter and also implement interface :D.

I wanna ask about code structure in code::blocks, I create new console application, my header will be put to Headers/include folder called Employee.h, then .cpp will be put to src folder. Now I create main class (I put outside of src folder) who will call the header, I just append the include code like this :

#include "Employee.h"

sure then the errors appeared after compiling: error : Employee.h: No such file or directory.

how to link the header to the main class properly?

this is my folder structure :

alt text

updated : It works, my include folder needs to be added on build options. alt text

Really thanks

+1  A: 

If you want to include your employee.h you must #include "employee.h" not Employee.h. Those are two different files.

jer
Probable the location of the file also needs to be validated.
ckv
ups sorry for my wrong typed, I mean I have Employee.h not employee.h, I really sure this issue is about wrong addressing of my header.
Mr.K
On case-sensitive OS. Makes for a bother to migrate from Windows to Unix...
Matthieu M.
my application structure:
Mr.K
+1  A: 

You need to add your include directory to your compiler's include path. This is going to be compiler-specific. e.g., if your structure is:

code
code/src
code/include

and you're running g++ from a terminal in the 'code' directory, you'd need to run (assuming your .cpp is Employee.cpp):

g++ -Iinclude src/Employee.cpp

I suspect you're running some sort of IDE, though: if so, do a search in its help for "include path" and it should tell you how to set it up correctly.

pkh
yeahhhh...it works, I need to add my "include" folder on build options. The capture is attached above.
Mr.K