VS2010 - About the Resource Relative Path - Where are variables declared - c++

I am trying to build a cpp project. On the project resources section there is a resource whose relative path is something like
$(QPID_BUILD_ROOT)\src\windows\resources\org.apache.qpid.messaging.rc
Where am I suppose to define this variable ? I mean where does VS2010 read this variables value from ?

These are environment variables. You can set them for user only, or for the whole system. You also can set what you want "ad-hoc", for example (assuming that your Visual Studio is installed in c:\Program Files\Microsoft Visual Studio 10 and that you want x86 build environment):
Go to start
Type cmd.exe
At the command prompt:
"c:\Program Files\Microsoft Visual Studio 10\VC\vcvarsall.bat" x86
set QPID_BUILD_ROOT=[some path]
Launch Visual Studio IDE: devenv
In the Visual Studio IDE you can use a dropdown list (e.g. on one of the VC++ directories) and the click Edit. In the dialog window click Macros - this will show you all the variables (including the one set above) currently available to Visual Studio.
Of course you don't have to set entire build environment (as shown in 3), this step is only needed to be able to just type devenv instead of typing the whole path to devenv.exe in 5.
Im assuming that you know how to set environment variables for user or the whole system and that you know that you need (at least) to lauch any application again (or even login/logout or reboot) in order for that application to inherit those new variables.

Related

Azure dev ops -- Set Visual Studio 2017 (VS2017) as default for cloning project

Azure dev ops -- Set Visual Studio 2017 (VS2017) as default for cloning project?
I have multiple versions of Visual Studio installed, and for policy reasons, I need to keep them, at least for a while.
How do I set up Azure dev ops so that when it clones a project via "Visual Studio" (from the dropdown) it will automatically select VS2017 as opposed to an earlier version such as VS2015?
I think this is determined by what version selector is targeted by the 'vsweb' protocol handler, i.e. it's a setting on your machine.
It seems like when VS2017 installs it doesn't always set the version selector to the 2017 version (which defaults to opening VS2017), rather than an old version.
This is set in the registry at HKLM\SOFTWARE\Classes\vsweb\Shell\Open\Command. The value will most likely be set to an older version, for example:
"C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSWebLauncher.exe" /openuri "%1"
Update it to be:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSWebLauncher.exe" /openuri "%1"
Obviously check the paths are correct before changing them, those are the ones from my machine.
It's always worth keeping a copy of the old value so you can put it back in if something goes wrong.

Can not create a new project in Visual Studio

I'm trying to open a new C++ project in Visual Studio(2012) but every time I create a new project this error pops up:
System.Collections.Generic.RandomizedStringEqualityComparer is not a
GenericTypeDefiniton. MakeGenericType may only be called on a type for which
Type.IsGenericTypeDefinition is true.
I've already changed the project path and restarted visual studio several times but no result.
Error Image
Try to reinstall or c++ compiler path was not set
Set Compiler Path or RunAsAdministrator
Now add the Compiler directory to your path:
Open the Control Panel (Start > Settings > Control Panel) and double-click the System program.
Click change settings links to open System Properties dialog.
Select the Advanced tab and click Environment Variables.
In the System Variables panel of the Environment Variables dialog, select the Path variable and click Edit.
Default Path of Compiler
Windows 7
C:\Program Files (x86)\Microsoft Visual Studio [Version]\VC\Bin\cl.exe
Windows XP
C:\Program Files\Microsoft Visual Studio [Version]\VC\Bin\cl.exe

mspdb140.dll is missing from your computer

I am trying to check if the visual studio compiler exist in my path. I have add vc/bin dir to the system environment path. When I open a windows console terminal I try to call cl.exe from the console. I am receiving the following message:
The program cant start because mspdb140.dll is missing from your computer. Try reinstalling the program to fix this problem.
What exactly is this message stands about? I tried to followed the instructions from this post, I run the bat file, (furthremore I add manually the dll dir in the path). However I am receiving the same message.
I have add vc/bin dir to the system environment path
That certainly isn't enough. Unclear what else you are doing. There are a wholeheckofalot more environment variables that need to be hacked correctly to allow proper compiling and linking. The values of INCLUDE and LIB are critical for example.
There is a .bat file that takes care of it, vc/vcvarsall.bat in the VS install directory. You pass the architecture you want to target, default is x86. Be sure you use the CALL statement if you use a .bat file yourself and that you in fact see the variables being set correctly with, say, SET INCLUDE. Watch out for a broken PATH variable, a very common scourge on programmers' machines. Usually corrupted by a wonky installer.
The VS installer creates shortcuts to run this .bat file. Used to be named "Visual Studio Command Prompt", might be "Developer Command Prompt". Got pretty muddy since Windows 8.
I personally just an entry in the VS Tools menu. Very handy. Use Tools > External Tools > Add button. And fill out the dialog similar to this:
Title = Command Prompt
Command = cmd.exe
Arguments = /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" x86
Initial directory = $(ProjectDir)
Tweak 14.0 to the version number of your VS version, that's VS2015. VS2013 = 12.0, VS2012 = 11.0, VS2010 = 10.0

Localize an MFC-based DLL?

I use Visual C++ 2008 to create a DLL which is statically linked with MFC. Now I need to localize the DLL so that it supports both English and German. I read the article at http://msdn.microsoft.com/en-us/library/x6h91d9w and it says to use localized MFC resources, one needs:
To cause your application to use these RC files instead of the files
located in MFC\INCLUDE, add a /IC:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO .NET 2003\VC7\MFC\INCLUDE\L.DEU to your RC command line (this
is just an example; you would need to substitute your locale of choice
as well as the directory into which you installed Visual C++).
Then how to do that in the Visual Studio environment, since I do not call the RC command line directly when compiling the project.
Thanks
Alan
You open the project properties in Visual Studio (one way is to right click on the project in solution explorer, properties is on the bottom) In the common properties there is a Resources section, in this there is a Command line section which allows you to add arbitrary strings which will get added to the command line.

Building Boost - can't find windows.h

I'm trying to build boost on windows 7 64-bits. Running bootstrap gives
execnt.c(29) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
and some others. I have visual studio 9.0 and the places where I have windows.h is in
C:\Program Files (x86)\Microsoft SDKs\Windows\v5.0\Include**W**indows.h, with capital W
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include**W**indows.h
C:\Program Files (x86)\Microsoft Visual Studio 9.0\SmartDevices\SDK\Smartphone2003\Include\windows.h
I have the SDK installed and even fully reinstalled Visual studio. Any way I can fix this?
Small update: I installed Visual C++ 2010 express and from the IDE I can include and the test project compiles just fine, but when I use the prompt NO projects can find the header
Try running the boost build from a VS console rather than trying to run 'cmd'. It's probably somewhere in the start menu entry for VS (used to be anyway). It used to also be available from VS itself under tools, but I think they removed it there.
This version is just cmd, but it runs a batch script that sets a bunch of very important environment variables.
For future reference of anyone looking for the same error
I have installed visual studio without registry edition permission, so I had none of the environment variables set, those that boost libraries / libxml2 et al look for when calling the cl compiler
Giving myself permission to edit the registry and uninstalling/reinstalling all visual studio related programs solved it
Edit %VS90COMNTOOLS%vsvars32.bat with administrator privileges any way you like, eg.
runas /user:Administrator "notepad %VS90COMNTOOLS%vsvars32.bat"
Find the section
:GetWindowsSdkDirHelper
#for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO (
if "%%i"=="CurrentInstallFolder" (
Change it to
:GetWindowsSdkDirHelper
#for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0a" /v "InstallationFolder"') DO (
if "%%i"=="InstallationFolder" (
When you install a newer version of the Windows SDK, it updates HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder to point to the newer version.
Unfortunately, the batch file that Visual Studio 2008 uses to set its paths uses this registry key to identify the location of the Windows SDK, so instead of pointing at the version of the Windows SDK that works with VS2008 (6.0a), it points to the the latest version to be installed.
Editing the registry is one option. A better option is to change the batch file so that it gets the right path from the registry, as above.