Reputation: 188
In my file explorer, my C++ project folders are like this:
... -> Documents -> C++ -> Files . . . . Projects
[In C++
folder, there are two more folders, called Files
and one called Projects
. I keep all my games/projects in the Projects
folder. Each game has its own folder inside.]
Now here's the problem: I want all my common functions (.cpp
& .h
) to stay in one file folder, so if I ever change it, it changes for all my games. I want to keep these in Files
. Is there a way to achieve this, like #include [Directory]? I know I can keep a file in its own game, but I want these to be all changed easily, and my code does not need to be transferred between computers. Thanks
Upvotes: 0
Views: 200
Reputation: 155
Solution for Visual Studio (2017)
For Source Files: In the solution explorer right click on Sourcefiles and click "Add"/"Add existing" and choose your file(s)
Setting Include directory:
Upvotes: 2
Reputation: 1535
This is not the right way to do it. If you have functionality that is shared between different applications (games, in your case), make a library from them and include that library in all your projects.
Upvotes: 3