I have the source code for a C++ library (its a version of Box2D)
I'd like to add parts of it to a new project and build it to a .dll
However when I add the directory of files I want to the new project it adds them all to the root of the project and as a result most if the include statements are wrong.. for example...
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2World.h>
The "Box2D/Dynamics/" part is now wrong.
I add the new files by putting the directory containing the files I want in the new project directory, then clicking the "show all files" button, then clicking on the folder and saying "include in project"
Heres what the original project (from which I'm copying the directories of of files) looks like..
and heres what my new project looks like. As you can see the whole project is 'flat' all the files are in the project root (though in the actual project directory the sub-directory structure is still present)
tbh I've always found this file management aspect of visual studio weird and confounding
The reason you do not see folders when you import files is that there is no folder to speak of. As you can see the filter overlay on the folder icons, there are just filters. You can also view properties of these folders to find out which files listed under that folder.
VS2013 uses projectFile.vcxproj.filters file to manage filters. You may try copying that file (or manually creating one) to your new directory and then import code/header/other files. AFAIK, VS should pick correct folder for file by looking file extension.
I made an extension for this purpose: https://visualstudiogallery.msdn.microsoft.com/5a3251d7-3228-4813-a67e-6b9cc83d0507
Sources being here: https://github.com/Dllieu/VisualStudioCppExtensions
Once you import all your files (e.g. same as your second screenshot), you just need to right-click on your C++ project and click on "Generate C++ Project Filters", it will create all the filter to replicate the folder hierarchy of your files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With