Share Files Between Projects
Jump to navigation
Jump to search
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article has no links to other VDC articles. Please help improve this article by adding links that are relevant to the context within the existing text.
January 2024
January 2024
This article is an orphan, meaning that few or no articles link to it.
You can help by adding links to this article from other relevant articles.
January 2024
You can help by adding links to this article from other relevant articles.
January 2024
In the creation of a mod, sometimes it is necessary to have a "global" file that both the "client" and "hl" projects can use. To set a file that can be updated from both projects, just follow these steps:
- Browse to your mod folder, e.g. C:\MyMods\Mod\ and go to the src directory. In this example, we are going to open the game_shared directory and create a new .cpp file.
- Create a text file by right-clicking the folder and clicking New -> Text Document. Rename it mysharedfile.cpp.
- Open up the solution file game.sln in VS.NET.
- Under the client project create a new folder under Source Files. Name it mod or whatever you prefer.
- Right-click the "mod" folder and select Add -> Add Existing Item.
- Browse to your C:\MyMod\Mod\src\game_shared directory and find mysharedfile.cpp. Double-click it to add it to your project.
- Repeat steps 4-6 for the hl project.
The point of doing this is that both projects now share the same file. This means it does NOT matter which project you use to edit your file, they will be updated and compiled by both. You can use this method for any type of file you want to share.
Note:You do not have to put your shared files in game_shared, it's just easier to keep organized that way. Feel free to create a whole new subfolder. Your includes might be a bit different then, e.g.
#include <mycustomfolder/header.h>
.