I installed the latest version of VS. However my project no longer worked. I tried relinking it but no success.
I then installed the VS version I was using before 2019. And after I relinked it worked fineā¦.
Which previous version were you using? There have been changes to the C++ language over the years and sometimes old syntax is no longer supported. Also VS C++ defaults to C++14. If you want to use a newer version (yes!) then you have to manually set the required version in the project properties. If the previous version was quite old, then the ABI may have changed which means that you have to re-compile all sources (including for any .dll) with the same version. This was a major issue with VS a few years ago. Versions of VS2013 and previous aren't ABI compatible with later versions. VS2015 and above are.
Another way to backup code: Use a NAS (Networked Attached Storage). I use Synology and the DS918+ and four 6 TB drives. It's essentially your own private "google drive" with some handy file management software (file-sync, on-demand-sync, RAID configuration, encryption).
Pros:
1. I have access to my code/books/media files from any device (as long as it's connected to the WAN): my laptop, my PC, and any roaming computers.
2. Computer totally failed/have to reinstall an OS? No prob. Get the CPU up and running again, download the Synology Client, and let it resync. Might take several hours to resync large media files e.g, movies.
3. I haven't tried it but I believe you can mount the path to a NAS as a drive. If that's possible, then you can create a bare git repo on it and use SCM to push your code to it.
4. On-demand-sync: A little more on this. Besides just syncing whenever you'd like or just leaving it to auto-sync whenever the client detects a file change, you have the option to keep the file on the NAS and have it download the file only when you access it. Great way to save disk space for larger files that aren't accessed often e.g., videos, at the cost of access time.
Cons:
1. Files that are actively being worked on should not be synced. You should pause syncing when working on code and only after finishing all code changes should you re-enable sync. If the sync software detects a conflict (i.e., two files with different file contents but the same name), it'll relabel the name of the conflicted file.
2. When you specify paths to header files, they must be specified using relative paths, usually relative to $(SolutionDir).
3. You must handle the management of the NAS yourself: security, user account creation, etc.
4. (Along with 3) If your NAS fails, you're done. Get a second NAS when possible and keep it synced with your main NAS.
5. Somewhat expensive. The NAS was $500. The (4) HDD was $650 so total is $1150. If you paid google $15/mo, you'd break even after 6 years.