VS2010 change Path Macro - c++

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%

Related

Missing xxx.dll when performing built executives in visual studio

The system warned that missing opencv_core331.dll
However, I have added the path of directory that include opencv_core331.dll to the environment variables of Windows:
Who can help?
This is a run-time issue, the libraries path has nothing to do with it. You need to either edit the global PATH variable or the executable directories in the project properties. I would personally recommend the global PATH variable because that way your program will run outside of VS as well as from it.
To do so, in the start menu search box type "environment" and select the ""Edit system environment variables" if you want to make the change for all accounts.environment variables for your account" or (

Qt Creator Modify PATH Environment Variable

I'm trying to find an equivalent feature in Qt Creator that I currently know how to do in Visual Studio.
In Visual Studio I'm able to modify the PATH environment in the Property Pages-> Configuration Properties-> Debugging-> Environment and I can set something like:
PATH=%PATH%;%MYENVIRONMENTVAR%
Where MYENVIRONMENTVAR points to a directory (lets call it C:\MYIMPORTANTDLLS) containing dlls needed for my program to run.
I'm looking for the equivalent of this in Qt Creator. In Qt Creator I thought I would accomplish this in Projects-> Select the Run tab-> Expand the Build Environment Details and modify the Path there. But I can't append an environment variable to the end of the PATH in that location. Instead I have to append the path contained in my environment variable to the end of the entire PATH, which would look something like this: PATH=C:\path1;C:\path2;C:path3;...etc...;C:\MYIMPORTANTDLLS.
If any of you know how this is done in Qt Creator then I would appreciate your help.
There is a way to specify other dependencies of the project immediately in the project .pro file. Example from project file:
OTHER_FILES += ..\third-party\libxml2\bin64\libxml2.dll \
..\third-party\libiconv\bin64\libiconv.dll
You were so close with opening Projects-> Select the Run tab (or Build if you need to change the path for the build step) -> Expand the Build Environment Details and modify the Path there. Then edit the PATH variable to
$(PATH);C:\YourPathAddition

How do I modify Visual Studio 2015 predefined macros?

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.

Environment variable overridden in Visual Studio?

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

Visual Studio: C++ Project Include Paths sharing over Repository

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.