Skip to content

Commit c1c7ac6

Browse files
authored
Update README.md
Made the process for creating new files and including it into the project clearer with better formatting and a warning at the start of that step
1 parent 14aeb5e commit c1c7ac6

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,33 +48,36 @@ The Python File `generate_cmake_presets.py` can be run with the following comman
4848
python generate_cmake_presets.py
4949
```
5050

51-
### 3. Creating files (skip if you're not creating new file)
52-
Depending on the method you used to create a new file, you will need to somehow get that file to the src or include directories. They will probably be directly under the ./build directory if you're already using visual studio. If not just locate the file(s) and cut and paste them to the correct place.
51+
### 3. Creating Files (Skip if You're Not Creating a New File)
5352

54-
If you used add class or new item in visual studio, you will need to simply cut and paste the files into the right folder (include being .hpp files, src being .cpp files).
53+
> ⚠️ **IMPORTANT: YOU MUST DO THIS EVERY TIME YOU CREATE A NEW `.cpp` OR `.hpp` FILE.**
54+
> If you don’t do this, the file will not be included in the project build. You must also rebuild the project after adding new files.
5555
56-
You can also just create the files in the src and include files then build the project to have them there.
56+
Depending on how you created your new file, you may need to manually move it to the correct directory. Visual Studio, for example, might place new files inside the `./build` directory.
5757

58-
After the files are in the src and include folders, you will need to add them into the `CMakeLists.txt`. You will scroll down to see the following
58+
If you used **Add Class** or **New Item** in Visual Studio:
59+
- Move the generated `.cpp` files to the `src/` directory.
60+
- Move the generated `.hpp` files to the `include/` directory.
5961

60-
```txt
62+
Alternatively, you can just **create the files directly inside the `src/` and `include/` folders** before building.
63+
64+
After the files are correctly placed, you must update the `CMakeLists.txt` file so that they are included in the build:
65+
66+
```cmake
6167
# Define Source Files
6268
set(SOURCES
6369
src/file_1.cpp
6470
src/file_2.cpp
6571
...
6672
src/file_X.cpp
6773
)
68-
# ... means that there can be more files between them
74+
6975
# Define Header Files
7076
set(HEADERS
7177
include/file_1.hpp
7278
...
73-
include/file_x.cpp
79+
include/file_X.hpp
7480
)
75-
```
76-
77-
Just add the filename(s) to this part of the `CMakeLists.txt` and build the project for it to work :).
7881
7982
### 4. Build the Project
8083
Navigate to the project root and run the following commands:

0 commit comments

Comments
 (0)