Compiling projects in different configurations in a multi-projects Visual Studio Solution - c++

I have a visual studio solution containing multiple projects. Just to simplify the testing, I have created 2 sub-projects. I need to compile and run one sub-project in Win-32 configuration because it uses an external DLL (win-32 config) and another sub-project in x64.
How can I do that?
UPDATE-1: I already tried to set the configuration of both the projects as shown in the screenshot below. But as soon as I build the proect then both the projects are build in the configuration which is selected in the main window.

Open the Configuration Manager (menu Build > Configuration manager). There, you can set the configuration and platform for individual projects for each solution configuration+platform pair.

Related

C++ MSVCP120D.DLL is missing

I am using visual studio 2013 and I build my project under release. However when I try to execute it on another machine without visual studio but with vc_redist installed, I get the error: msvcp120d.dll is missing from the computer, which is used when a project is compiled in debug. Any way to solve this problem?
You need to change settings in Project properties
Right click on your project > Properties > C/C++ > Code Generation
and inside you have to change Runtime Library from Multi threader DLL (/MD) to Multi Threader (/MT). This way you won't need to include additional libraries with your build.
First check that all your projects are actually set to build in Release.
You do this by opening the 'Configuration Manager' from Build -> Configuration Manager...
Select Release and Win32/x64 whatever you are building and then ensure all your projects are set to Release configuration.
If they are all fine then you will need to either manually check the Project settings for each project, or you can use an application such as Depends to help find the offending EXE or DLL.
http://www.dependencywalker.com/
I just installed both vcredist_x86 and cvredist_x64 and it works.

How to open existing C++ project with Eclipse?

I have two projects in C++ that I need to run and build both in Windows and Linux.
We are using Microsoft TFS for source control.
For windows we are using Visual Studio.
For Linux we are using Eclipse. (I don't have much experience with Eclipse)
I had managed to configure and build properly the projects in both platforms.
I checked in TFS the .cproject and .project from eclipse, so I can use it in another computer.
Now I am trying to get the projects in another Linux computer and I don't know how to do it.
I tried following this instructions, but I don't have my source code zipped.
Other places like here suggest creating a new project.
Isn't there a way to open an existing project in Eclipse similar to Visual Studio?
Do I have to create a new project? If so, how can I keep the configurations I did to be able to build the project so other developer can use them?
File > Import... > General > Existing projects into workspace
Don't select an archive file. Set the root directory to where your .project and .cproject files are located. Your project should show up in the list. Make sure you don't forget to check the checkbox in front of your project.
Committing eclipse project files to a version control system is perfectly fine as long as you don't use absolute paths in your project settings. Use environment variables to specify paths which differ between developer machines.

Porting several dependent C++ makefile projects into MSVC

I have several projects which depend on each other. For example, when I install them I do this:
Project1:
/configure & make & make install
Project2:
/configure & make & make install
Such that "Project2" depends on some libraries of "Project1". I want to create an MSVC project for Project2, and start working with it, and changing it (and compiling it inside). How can I do this?
Also, how different is this to be done in linux with Eclips (when you don't have admin permission and can't do 'make install')?
You can create project dependence in Visual Studio.
To assign dependencies to projects
In Solution Explorer, select a project.
On the Project menu, choose Project Dependencies.
The Project Dependencies dialog box opens.
On the Dependencies tab, select a project from the Project drop-down
menu.
In the Depends on field, select the check box of any other project
that must build before this project does.
You can read more about it here
Visual Studio is your usual clickfest, but you can define project dependencies.
Define one project per module, then go to the solution properties tab and, for each project, select the checkboxes that inform the IDE that this project depends on a set of other projects.
The IDE will then sort and build them in the appropriate order.

Multiple build targets in visual studio C/C++

Is it possible to compile in one fell swoop multiple build targets? For example, I would like to compile an .exe and a static library which includes everything but the .c file that includes main()
If that's not possible, how to manage multiple build targets like this?
You actually can build multiple configurations of the same project. So you need make sure each individual configuration builds okay and in separate path. Then you can use Batch Build dialog to do build all in one time. I hope it should be even possible to build exe and dll using the same project, but different configurations.
Build multiple configurations simulataneously:
On the menu bar, choose Build, Batch Build.
In the Build column, select the check boxes for the configurations in which you want to build a project.
Choose the Build or Rebuild buttons to build the project with the configurations that you specified.
For more reference, see the batch build dialog box.

Using Separate Libs for Debug and Release in VC++

I'm downloading GLFW for use with Visual Studio 2010. I see that the download has a separate folder for Debug and Release builds (each folder has two Libs and one DLL), but the filenames in both folders are the same. How should I configure Visual Studio to pick the right file, since I would expect that renaming a Lib or DLL would interfere. My research has been relatively unfruitful, and I think it may have to do with ifdef commands or something. Thanks in advance.
Visual Studio build properties (including the directories where it searches for files) are all build configuration specific. On the project configuration dialog, just press the drop-down to switch from Debug to Release. The settings you change will affect that particular build configuration and no others.
If you don't have this dropdown, then you're using the non-advanced interface, which no human being should ever use. Switch to the advanced interface.