Hi, in java, I can use packages to combine classes which have similar traits. For example, I have a package "worker" and classes in this package contains "Programmer.java" and "Designer.java"

I want to know how to do this in C++. What I did was this:
1. created a source folder called "actor"
2. inside the directory, I created an "actor.h" and "actor.cpp"
3. now I created another folder called "camera"
4. I created a "camera.h" and "camera.cpp" inside it.
5. "camera.h" depends on "actor.h" -> this is where the problem started.

It seems that camera.h cannot see actor.h I tried

#include "actor/actor.h"

in the camera.h but it still did not find the header. What am I doing wrong? My goal is just I do not want to put all headers and cpp files in a single directory. Suggestions are welcome. Thanks!

C/C++ use "libraries", and "dll"s (MS-Windows) not packages. How to create one depends on the compiler you are using. Normally the source code for a library is all in one folder, and it doesn't matter what the folder name is as long as your compiler knows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.