Public Group

# Working on C++ Visual Studio projects across multiple PCs?

This topic is 1158 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi Guys,

I am working on some C++ projects (Using VS 2013), and I have a pc at home and a laptop I want them synced across. I use google drive for everything else but for these projects its a bit different, because sometimes the project will include a library or header file that is somewhere else relative to the project, or it will need to include an entire library such as boost.

I have kinda 'hacked' it to work for now. As long as google drive is installed in the same location on both pcs (In this case user/username/googledrive/c++) the projects work fine..

But the annoying thing is for instance both pcs need to sync up the entirety of boost, which is 500 meg, and 45k files. I know I could download boost separately on each pc, but then If I am working on one pc and need to update it, the update will not go to the other pc unless I either remember to download boost again, or sync it across google drive.

I have never used GITHUB or any of that source control, so am wondering if it is the solution to my problems.

Any advice or a better way to do this is appreciated.

Thanks

##### Share on other sites
The other option to using relative paths (or messing with environment variables or scripts which is kind of overkill), assuming these are external libraries that you don't need to version control, would be to install the libraries on each machine and create a property page in a location the project can find that can be customized on a per-computer basis.

##### Share on other sites

Or you could place your project (and dependencies) on an external fast hard/flash disk and carry that with you, although it's just a thought that I haven't tried personally.

##### Share on other sites

Okay thanks guys, I think I understand how to go about things.

From what I gather GITHUB only worries about actual source files, but wont store visual studio .sln files. So for a pc specific item like that I need to either sync it like I am or just set it up the same on each pc...

Version control won't solve this, this is purely a project organizational issue. Your dependencies (libraries you use) for a project should usually be part of that project. I usually stick them in an "External" or "Dependency" folder. Then you can set up your VS projects (or whatnot) to refer to them via relative paths and they will always be correct on any machine.

One thing I dont fully understand about this is what if multiple projects require the same dependencies. Again using boost for example, if I have my project in c++\project1\, do you mean add boost to c++\project1\boost_1_58_0

In this case, what if project 2 also needs boost? Do I reference it to project 1's boost? Or make a seperate boost in its folder e.g. c++\project2\boost_1_58_0?

And what would be the benefit of this over juyst having it in c++\boost_1_58_0 and having them both ref that?

Lastly, is there a way (is this even a good idea), to figure out what excactly is used in the dependancies, and jsut take out the .h and.cpp files for them? Some projects are using SFML and I am not worried about syncing the whole folder as it is only 50 meg, but I am sure 98% of boosts files I wont be using...

##### Share on other sites

For both git and svn, I just use the ignore feature to strip out the build output directories, and other per-user / per-machine files (e.g. for Visual Studio stuff .sdf and .suo).

Third party dependencies are more tricky. At work we put the original download tar/zip/etc. in the projects SVN, then have a fairly complex set of build scripts to build all the third party stuff correctly as well as our own stuff (not doing C++ stuff on Window's, so things like the DX SDK and Window's SDK that don't do this have not come up, but would surely cause a lot of irritation. IIRC we even have the GCC and Java rpm's in their and install them into a chroot on the Linux build servers).

For personal stuff I have never bothered, I just have a "Third Party.txt" detailing and linking the third party dependencies, and need to download and compile them on each system I use into a Third Party directory. I did define custom MSBuild properties in a property sheet, so I can just do say "$(BoostLib)" in additional link directories, but not figured out if a dev can override these should they put boost somewhere other than "$(SolutionDir)ThirdParty\boost".

##### Share on other sites

Git can be a bit of a steep learning curve vs other forms of source control but it is worth the effort to learn it. I use SVN at work but switched to git personally and would not go back. It is just better at branch management imho

If you use github (not required to  use git) and you don't want to have your source public it will cost you money to make private, not sure the cost but it is not that expensive.

The other way around this is via dropbox, see following.

Git has two types of repository. Bare and working. The bare is a pure repo that you do not work in, it is the master copy of your source. You then clone it locally as a working copy. When you commit files it goes into your local copy which you then have to push back into the master.

One thing I have done in the past it store the master bare repo in my dropbox directory and then have my working copy elsewhere. When you push to master dropbox will sync and then you can pull from master on your other machine to get the latest code. So dropbox becomes the sync means for your master.

Now the word of warning.... DO NOT let two different machines manipulate the master at the same time and after any interaction make sure your dropbox is fully synced (Push or pull) before you interact with the master again or you could damage the repo and possibly lose everything.

Once you have worked with and get used to source control you will wonder how you ever coded without it :)

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
12

• 14
• 22
• 9
• 31
• 18
• ### Forum Statistics

• Total Topics
632618
• Total Posts
3007476
• ### Who's Online (See full list)

There are no registered users currently online

×