I'm using Visual Studio Express 2013 and trying to compile someone else's code. The documentation tells me to set the environment variable QTDIR in the command line and then launch VS from that terminal. But the compiler still thinks QTDIR is what it originally was instead of what I specified in the command line.
I've tried to restart the computer and do it again, but the result didn't change. I looked into the project properties, but found nothing that seems to be overriding this variable. And when I clicked the "Macros>>" button in dialogs such as the editing additional include directories dialog, it says QTDIR is what it was originally. (Weirdly: this happens only to one project in the solution; when I opened the Macros>> from other projects, QTDIR is what I specified in the command line!)
So I was wondering if there is something that can override an environment variable like this in Visual Studio. Thanks!
Edit: The confusing part is when I looked at the property pages of the projects, under Common Properties >> User Macros and there's nothing defined there.
I can only tell you about VS 2010, but in that one, macros can be defined on a per-project basis in Project Properties > Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions. You might look there.
It sounds like there is a user-defined macro for QTDIR in your project that you need to remove.
Try the following:
1) Open your solution in VS2013
2) Open the Property Manager by going to View >> Other Windows >> Property Manager
Now you you'll see a hierarchy of Projects, Configurations, and Property Sheets. The User Macro you need to remove will be set in one of these property sheets (probably the one that ends in .user).
3) Open each property sheet (one at at time!), and find the QTDIR Macro under Common Properties >> User Macros. If it's there, select it and click Remove Macro.
Hope this helps!
Source: http://msdn.microsoft.com/en-us/library/669zx6zc.aspx
Related
I'm working on an existing project, the solution contains quite a lot of projects with a lot of dependencies and variables.
I'm struggling to locate any of the variables using the IDE, where will I find these in the IDE?
For example in one of the .vcxproj files there are variables such as:
$(FraenkelPlatformName)
Where would I find this in the IDE ?
Edit:
Edit 2:
Ok, based on the great comments on my post, but no answer posted this is what I need to do:
From the VIEW top line menu, select Property Manager
Select a project from the left "Property Manager" panel and expand the node.
Open a build folder, Debug or Release and double click on buildvars
From Common Properties select User Macros
All the variables are listed here and can be Added or Removed.
I'm trying to modify a predefined environment macros in Visual Studio 2015. Specifically this: VC_IncludePath
I can see it and its value, but I can not modify it. I don't see the option to do it.
You can edit this file:
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Common.props
The value of this macro is automatically generated from the versions you have set in the property pages. Select Project, Properties, Configuration Properties, General and check that the Target Platform Version and Platform Toolset are correct for your installation.
For other versions, search 'Microsoft.Cpp.Common.props' in windows explorer at C:.
You may find several depending on versions installed.
Then, right click the version you want and Open > choose VS (easier to see the lists) or any. However, no VS environment variables are there to edit.
The place to change that environment variable is in the project property page Configuration Properties -> VC++ Directories as described in the MSDN documentation.
I was wondering how should I add my library include paths and linker paths in Visual Studio so that when I add my project to a repository, another developer checking out my project would not need to go through all the include paths and change them for his own machine. So, I am kind of looking at something like ${MY_THIRD_PARTY_LIB_INCLUDE_PATH}\tbb\include and ${MY_THIRD_PARTY_LIB_LINKER_PATH}\tbb\lib\ia32\vc11 so that someone accessing the project can just change MY_THIRD_PARTY_LIB_INCLUDE_PATH and MY_THIRD_PARTY_LIB_LINKER_PATH and everything works as intended. Can somebody suggest a best practice around this or may be how to accomplish what I just described?
In VisualStudio 2012 I use Project Properties
So if you go to the Propery Manager you Add a new Project Property Sheet to you project. From there, a couple of things can be set
User Macros - We create a macro here and put in a path for our environment. We crate a Macro called CUSTOM_DEBUG_PATHS, and then in the project we set the Debugging->Environment to path=$(PLA_DEBUG_PATHS);$(PATH)
The other thing that we do in the Project Property Sheet is change our Include and Library directories. We have everyone use relative paths, but you could put in an environment variable or something in here so that everyone could use the same file.
Hi I have a VS2010 projekt witch i moved from one machine to another. And on the new machine the QT installation is in a different place.
Now the projekt can´t find the QT headers and libs. When i look in the projekt properties I see that all QT path are set with the makro $(QTDIR) and this path is the path of the old machine.
Is there any way to change the value of the makro?
THX for help
There is such thing as User Macros in VS 2010. It can be defined in Property Sheets. To find it you should open View->Property Manager panel, and there you'll see your projects and configurations. It will look like this:
In my project, I have a foldernames property sheet, in QT the name might be different. So you should right-click the property sheet and you'll see User macros page under Common properties:
Check there for your QTDIR macro.
I believe QTDIR is system/user variables that you need to define on your Windows.
You can take a look at : http://support.microsoft.com/kb/310519 that explain how to set the value.
Or, you can take a look at: http://www.itechtalk.com/thread3595.html
Once you set the variable, you may need to restart visual studio
To check if the variable has been set, type the following in command prompt:
echo %QTDIR%
I am new to Visual C++.
I am trying to use library A that in turn uses another library B. When I try to include the header of A, I get an "Error C2061: syntax error : identifier 'GUID'". This error is triggered in a header in library B. When I examine the line that throws the error, the issue is that the header in library B is using a definition found in Guiddef.h, which is a microsoft header.
The problem is that I can't seem to be able to add this header or to create a project that adds it.
I am using Visual Studio 2010 Premium.
Any ideas of what I am doing wrong?
Don't know what you mean by add it to a project or create one that adds it ,but when guiddef.h is on your system and your directories (in common properties) to your MSVC environment are correctly setup ,you just have to add #include <guiddef.h> before the including of lib-headerfiles to your cpp or h files and everything will (should) be fine.
guiddef.h is part of the Windows SDK. If you have VS 2010 Express the SDK is not included, you'll need to download it separately.
If you're using a VS SKU that's 'above' Express, the SDK should already be installed (I'm not sure if you can deselect it or not when in stalling). By default it'll go into:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\
The "Visual Studio Command Prompt" shortcuts that VS installs should set the INCLUDE environment variable appropriately. And a default C++ project should also have the include path setup appropriately, but it can be changed in the project's "VC++ Directories" property (you should check that). If you have a per-project setting here that is wrong, change it there.
However, if your 'IDE-wide' VC++ Directories properties that are inherited by every (or at least most) C++ projects is messed up, follow the instructions on this blog article to fix the global VC++ Directories settings in VS 2010:
http://blogs.msdn.com/b/vsproject/archive/2009/07/07/vc-directories.aspx
Specifically:
If you open up the Property Manager view to see the property sheets associated with your project, you’ll see that one of the property sheets is named Microsoft.Cpp.Win32.User. This property sheet is actually stored in LocalAppData, just as VCComponents.dat file was, in the directory %LocalAppData%\Microsoft\VisualStudio\10.0. Using the property editor on the property sheet (just right-click on this property sheet node and select Properties...), you can see that you are able to make edits directly to this file. Since all projects, by default, import this property sheet, you are effectively editing the VC++ directories in the same way you were able to do before.
It's possible (though not necessarily true) that you need to include a library as a linker dependency. I'm assuming here that you're already using #include (and have the correct case, with a lowercase 'g')
My suggestion:
Open up the project that has the
header included
open the 'project' menu, and select
'properties'
Under 'configuration properties'
select 'linker'
under 'linker' select 'input'
take a peek at the 'additional
dependencies' field (right at the
top on the right hand side). You
may see some libraries listed there.
Make a note of any libraries
included as dependencies, and repeat
these steps in your 'broken'
project. Add the appropriate libraries to the 'broken' project, if needeed.
You probably don't need the same dependencies in both projects, but if you do need to link a library in the borked project, you should be able to narrow down which one it is you need and include it in the dependency list.
Hope that helps, or at least doesn't steer you too far off course!
edit:
Actually, for some of the headers in the windows API, you might not be able to include them 'alone' (I'm not sure if guiddef.h is one of them), but they should be included as a sub-header of windows.h.