How to move some files under version control from one project to another in Visual Studio 2015? - c++

I use c++, mercurial as VCS and IDE - Visual Studio 2015. Sometimes I need to extract some files from project to separate project (in the same solution). Now for that I have to:
create new project in the same solution
use mercurial "rename" for all files I need to move
remove files from source project manually via Visual Studio
add files to destination project manually via Visual Studio
fix includes in these files
maybe something else (change namespace, etc.)
It would be nice making items 2, 3 and 4 at once (and somehow automatically). I Can't find anything suitable so I will be very grateful for any advice about it (maybe some tools, scripts, Visual Studio extensions or something else).

Related

How does Visual Studio and Github work together?

For example: I'm making an SFML game and I want to store my project on GitHub so my team members can have access to it. Since its made in Visual Studio does that mean I need to include: Solution file and .vcxproj file?
Also, I've seen projects on GitHub have a "src" folder to organize their repository, since mine was created in Visual Studio does that mean I need to rename my folder that is named after my project to "src" and reupload it? Or are people doing some sort of organization trick I'm missing?
Since the game is SFML, all my binaries (.dll) files are just thrown into my main folder of the project, I'd much prefer to throw them all into their respective folder, but if someone downloads my project does that mean they need to pull it out of that folder and throw it into the project file? (That way visual studio can find them)
TLDR: I'm having trouble organizing my GitHub repo with a Visual Studio C++ Project.
Since its made in Visual Studio does that mean I need to include:
Solution file and .vcxproj file?
Yes, you'll need to include solution and project files. You can see which files you can ignore at gitignore.io. Or, you can use cmake.
I'd much prefer to throw them all into their respective folder, but if
someone downloads my project does that mean they need to pull it out
of that folder and throw it into the project file?
Yes, each collaborator will have to download libraries and make it available to project on their end. And if you have lots of libraries and libraries depending on other libraries, updating them can be painful.
I use cmake and vcpkg. It isn't as straight forward as keeping libraries in project folder but requires reasonable effort for keeping project organized and clean. I'll recommend this approach.

External C++ source files in android studio?

Here is the drill. I have a cross-platform project written mostly in C++ (more on this later) that runs on windows, android and ios.
Is there any way in which android studio can be configured to have a custom directory that contains all the native C++ code ? By custom, I mean external to the main folder in which the android studio project resides in.
I'm guessing you can see where I'm getting at... I have a cross-platform project that can be opened from 3 different IDE's... visual studio, android studio and xcode and I want to be able to write / edit / compile the code from all of them.
Let's say I have the following main hierarchy:
projectDir
src (C++ source files .cpp)
include (C++ headers .h)
_visualStudio (visual studio project)
_xcode (xcode project)
_androidStudio (android studio project)
assets (resources .png etc)
others...
This is what I want to achieve, but I am unable to figure out how can I configure an android studio project to be able to accept external source files, but most importantly to be able to see and edit them from the android studio IDE. Basically I want to tell android studio... "Look, this is the path for the native files, treat them as if they belong to the project".
I know this is possible from visual studio and from xcode because I already did that, but up until now I used my own build system for android and I had no need for android studio. Is there any way to achieve this ? Perhaps some kind of symbolic folder links ?
The thing is I want to keep only a single copy of my shared resources (src, include and assets should only be in one place, but should be available for android studio as well).
So far the only solution is to keep them inside android studio project directory, and change visual studio paths to look for them there, but I find this very nonprofessional.
EDIT:
Is there any addFileToProject (as in visual studio) in android studio in which the file can be outside the project ?
After a bit of more digging I found that it is actually possible.
You just have to create a directory junction like this (inside app/src/main/cpp where the files would normally be).
mklink \J linkName linkDestination(can be outside the project)
Android studio will be able to see the containing folder as it's own (it sees it as a link, but you can double click it to expand the contents). You can also edit source files inside it with the only mention that you have to add these files within CMakeLists.txt or whatever build file you are using in order to have intellisense (you get a sync warning from android studio if the files aren't referenced anywhere in the build files).
Later edit... if you are using junctions for Java / Kotlin files in an android studio project, make sure to set the source sets through the junctions as well... in order to avoid visual errors like 'duplicated class'.

How to produce platform independent source files (which can generate project files for anyone using cmake) from a visual studio solution?

I know cmake is a tool which can produce visual studio solution files from source files. I see many of c++ projects are stored in the github in that way. My problem is how create that source. Is there anyway to generate it on visual studio or anyother way.? I have created a project by using visual studio . So I have the solution file. I want to upload it in to github as a portable source which can produce project files later using cmake for anyone.

Visual Studio 2010 Creating Packages/Folders in project

I am new to Visual Studio 2010 C++, I am trying to create packages in my project like we do in Java Eclipse but to my surprise the only option I found available was Creating a Folder so I selected that and created several folders added my classes to them then I tried including my header files in the folders I had created but it keeps giving me an error to hat I cannot locate the file, I checked in the Project directory and the folders are not in there but very visible and editable from Visual studio, I tried manually adding a folder with my classes from windows explore and still could not locate them in VC
The logic is organized slightly different than in Eclipse.
With Visual Studio, you create a solution (one directory) in which you will create one or more projects (either in the solution's directory, or in one or several subdirectories. I you have in your components a shared library for example, you would put in a separate project.
The source files in each project are organized in the same directory. If you use folders in a project, these are virtual and not materialized in the OS directories.
Remark: If you really want to organise project files within "hard" subdirectories, you can always force the directory in the item creation dialog. This is particularly practical if you add to a visual studio projects existing items stored according to a more complex OS structure. Unfortunately such a directory structure is not at all displayed in the solution explorer, so it is somewhat confusing.

Cross-platform svn management (Makefiles & Visual Studio)

I'm working on a little game called freegemas, it's an open source version of the classic Bejeweled written in C++ and using gosu as the graphic API. I've been developing it under Ubuntu Linux as usual, but the other day I wanted to give it a try and I compiled it on Windows using Visual Studio 2005 (which I had never used before). The program worked flawlessly.
To compile it on Windows I manually copied all the source and header files to a new project on MSVC, but I would like to adapt the SVN so I don't have to recreate the project every time I want to compile it.
Therefore, the question would be: What's the best way of organizing the svn so I can have, on the one hand, a Makefile to compile the project in Linux, and, on the other side, the MSVC project's files? Right now I've got a simple folder called trunk with all header, source and resource files on it.
I've never used Visual Studio before, so I don't know which files are the most important either. Maybe some of those files are auto-generated and do not need to be svn-versioned.
Thanks in advance.
You could just keep the project files in a seperate directory "winbuild" or similar. Still, to maintain them would require manual interaction (ie adding every new file manually). The only files you would need to upload to svn are the *.vcproj (for MSVC 2005/2008) and *.vcxproj (MSVC 2010).
Alternatively, you could opt for a cross-platform solution like CMake, which could generate makefiles and Visual Studio project files from a common CMakeLists.txt, which is the only "project file" that would have to be maintained (instead of your makefile). Especially for a simple (?) project like yours (some headers+sources). There would be no need to include any makefiles or vcproj files at all, just the CMakelists.txt file would suffice.
There are others like CMake (SCons, boost.jam, jam, premake, etc.)
It should be feasable, but requires some testing and trial-and-error.