Have you ever had this problem:
When vs is used, some non-built-in libraries, such as wtl, boost, and DX, are sometimes used. Each time you need to use them, add the corresponding include directory to the project attribute, over time, I felt a little troublesome. Is there a solution?
So I found a related article on the stackoverflow website.Article(Original article link), one of the methods mentioned in the article is to modify
C: \ Users \ <user> \ appdata \ Local \ Microsoft \ msbuild \ v4.0 \ microsoft. cpp. win32.user. PropsThis file adds the directory to be included in this file. I have been using this method for a long time, and there is no problem.
After I installed vs2012, the problem changed. When a new MFC project was created in vs2012, nothing was done, and the compilation failed. When I was prompted that some files could not be found, I thought it was affected by the previous modification, so I decided to restore the modified file to the default content. Try again and the result will be okay... However, you have to manually add the wtl directory every time .. I started to flip through some configuration files of.
Solution 1:
Modify"\ Vc \ vcwizards \ default. vcxproj in the vs installation directory"This file (this is actually an XML file)
For example, my directory is"D: \ Program Files \ Microsoft Visual Studio 11.0 \ Vc \ vcwizards \ default. vcxproj"
If the directory I want to add is"D: \ Program Files \ Microsoft Visual Studio 11.0 \ Vc \ wtl \ include";
Open the file in a text editor and locate it at the end of the file.</Project>Insert the following content
<Propertygroup><Includepath> $ (Vcinstalldir) \ wtl \ include; $ (includepath)</Includepath></Propertygroup>
$ (Vcinstalldir) \ wtl \ include;The directory to be added.$ (Vcinstalldir)Is the environment variable in vs (on my computer, it is"D: \ Program Files \ Microsoft Visual Studio 11.0 \ Vc"), Indicating the installation directory of VC.$ (Includepath)Yes indicates the original path. In fact, there are four
If you want to add the path of the Lib file. The format is<Librarypath> </librarypath>
After adding the file, save it. After creating a new project, you can see that the directory has been added to the project properties. As a result, vs2010 uses the same method, but the directories are different.
Solution 2:
This method is combined with the modification method on the stackoverflow website mentioned at the beginning.
Still modify"\ Vc \ vcwizards \ default. vcxproj in the vs installation directory"This file is modified differently here. Open the file in a text editor and search for it"$ (Userrootdir) \ microsoft. cpp. $ (Platform). User. Props"This section,
Actually, this is the file that points to my computer.C: \ Users \ hwangbae \ appdata \ Local \ Microsoft \ msbuild \ v4.0 \ microsoft. cpp. win32.user. PropsHere, I thought of specifying different files for vs2010 and vs2012,
Set"$ (Userrootdir) \ microsoft. cpp. $ (Platform). User. Props"Replace all"$ (Userrootdir )\Vc11 \Microsoft. cpp. $ (Platform). User. Props".
ThenC: \ Users \ hwangbae \ appdata \ Local \ Microsoft \ msbuild \ v4.0This directory creates two folders named VC10 and vc11 respectively, and thenMicrosoft. cpp. win32.user. PropsCopy to these two folders, and all files except these two folders can be deleted. Other files Vs will be automatically re-created in those two folders;
EditMicrosoft. cpp. win32.user. PropsThis file, in<Project>Insert the sameCode. Make the same replacement under the vs2010 directory. This is the end of the process. The test has no problems.
To sum up the differences between the two methods, after method 1 is modified, it is only valid for the newly created Project, and the project created before modification is invalid, the method is also effective for projects created earlier. Which method is suitable for your choice.
Indicate the source for reprinting. Original address:
Http://www.cnblogs.com/hwangbae/archive/2012/06/24/2560463.html
If this article is helpful to you, please support it. Your support is the greatest motivation for my writing. Thank you.