I love external libraries. A good library (one that is well-tested and interoperable) literally saves years of development time. Since this post revolves around C++, I'm going to mention Boost as one of the most helpful libraries ever made. Visual Studio provides a fairly obtuse (but working) system for referencing libraries on a per-user, per-system basis, accessable from the Tools > Options menu:
It doesn't look the most user-friendly and it's a little bit painful to get to (especially the first time), but it got the job done. Theoretically, you only go into this menu (or you write a script to do it for you) once per library and never touch it again.
Naturally, when I began testing Visual Studio 2010, the first thing I wanted to do was set up my include and library paths. So, I opened the options dialog only to find that Microsoft saw fit to remove this feature. My first reaction was: "WHAT? WHY?" and I went on a hunt to see where they had moved that option to (because it is basically impossible to live without). It turns out they had moved -- to the property page of the project (just right-click the project and open properties):
This is basically an extension (duplicate?) to the Visual Studio 200x options for the C++ compiler settings, which let you specify more directories to search through when looking for header files (a similar option exists for the linker in "Additional Library Directories"):
But before you start adding references to "C:\Path\To\Library" in all of your projects, let me tell you about a feature of Visual C++ called "Property Pages." Personally, I have not seen them used very much in various projects for a number of reasons, the number one being that they are quite difficult to find, number two being that their visibility is not enabled by default, number three being that you do not have to know about them to get compiling in VC++ and lastly because their functionality is a little odd.
How to Use Property Sheets
These instructions will work with Visual Studio 2005, 2008 and 2010 (and probably beyond).
Anyway, the first thing you need to do is turn on the Property Manager toolbox. Do this by hitting "Property Manager" under the "View" menu. The toolbox will probably attach to your Solution Explorer, but it could just appear in the middle of the screen. In either case, you should see a tree list of your projects, which have a cross-joined list of all solution configurations and platforms as children, which have a collection of settings sheets:
Okay, let's add a property sheet that defines the symbol _DEBUG and add it to all the debug configurations. Right-click on any debug configuration and select "Add New Project Property Sheet."
If you are planning on using this sheet in multiple projects, it is a good idea to put the file in a directory that is not project-specific. I made a directory called "Properties" in the solution directory to store all my property sheets. A special note: At the time of writing, Visual Studio will give you an exception if you try to make a new property sheet in a directory that does not exist (error reported to Microsoft Connect), so you have to make the folder in Explorer or something first.
Open the newly-created file by double clicking and you should see a window that looks almost identical to what you would see if you opened up the "Properties" dialog from the Solution Explorer, save that there are a million options to configure. The reason there are so many options to configure is because property sheets are not tied to any project, so all configurable options show up in the GUI.
Go into C++ > Preprocessor settings, add "_DEBUG" to the definition list and click OK. Now you can add this .vsprops file to multiple projects. You can actually share the .vsprops files between Visual Studio 2005 and Visual Studio 2008, if you are planning on maintaining two solutions for two separate consumer groups. Unfortunately, Visual Studio 2010 creates a .props file, which is completely different XML and cannot be shared with previous versions of the IDE (but it can convert them). A fun quirk is that you have to right-click on the individual sheet to explicitly save them (do not worry if you forget to do this, you will be asked when you exit the IDE).
Okay, so making a whole file and screwing around with all this stuff just to define another preprocessor macro is pretty pointless. However, you can see that you have complete control over all the properties of VC++ projects, which means you could make another one for release that defines specific optimization settings for every project or a general setting that tells all projects to output to some shared output and intermediate files (I use a variation of "$(SolutionDir)/bin/$(ConfigurationName)/$(PlatformName)/$(ProjectName)" and "$(SolutionDir)/obj/$(ConfigurationName)/$(PlatformName)/$(ProjectName)"). Property sheets let you consolidate shared settings to arbitrary levels of granularity.
So if you have two property sheets, one which sets the output directory to "$(SolutionDir)/bin/$(ConfigurationName)/$(PlatformName)" and one that sets it to "$(SolutionDir)/bin/$(ConfigurationName)-$(PlatformName)", what is the value of $(OutDir)? The answer is whichever one was evaluated last. You can tell the order of evaluation by the order the sheets are listed in the Property Manager toolbox. Evaluation occurs in a bottom-up order, so those sheets on top are evaluated last.
Back to the origninal problem: How can we use property sheets to make up for the lack of global VC++ Directories? Even if we make a property sheet that adds a reference for #includes to "F:\Applications\Dev\boost_1_40_0", what happens when another developer has their Boost library in "C:\SDKs\boost1.40.0"? Project property pages have not solved this problem, since changes to the file would get propagated over source control and screw up the settings for everyone else. Wouldn't it be nice if there was a user-specific property page that was defined outside of the project?
In Visual Studio 2010 there is such a file: Microsoft.Cpp.Win32.user, which exists somewhere in your user application settings. The good part about this change is that settings now reside in an overridable format. If your project uses a modified version of some library, the project property sheet can add a search path to "$(SolutionDir)/ModifiedLibrary", which will be searched before the user files. Granted, the change significantly changes the configuration system (in a way that takes a while to explain), but I think it's for the best. There are also still some quirks with how adding different configurations will propagate certain sheets, but its still in beta, so hopefully they will be smoothed out.
Subscribe to:
Post Comments (Atom)
I only use vc++2010 express, how do i save property page so that I can use the same through different project? Thanks
ReplyDeleteThe property manager might be in a submenu of views... "Other Windows". It's almost 5 AM, and I thought I'd setup my VS2010 dev env- big mistake, haha.
ReplyDeleteIt is't in View->Other Windows :(
ReplyDeleteThanks for posting this
ReplyDeleteTo get this in VS 2010 Express You first need to do Tools -> Settings -> Expert Settings.
ReplyDeleteThen you can get the property pages view etc.
Thanks so much for this - some of the stuff in other places on the web leave one more confused rather than explaining things well.
ReplyDeleteI've done what you stated and been able to set up two property sheets which I can easily add to any project that uses them (or one of them).
Seems more sensible than altering the default props file and it's SO easy to do if one saves all one's new Property Sheets in a generic place.
Thanks again.
During last few years' investment in property and real estate has emerged as one of the most profitable businesses throughout the world.
ReplyDeleteParcRiviera.net
Check how repairs and maintenance issues are handled. If you are satisfied with their present and previous work then go ahead with them. Apartment property management
ReplyDeleteAwesome post, and incredible site. A debt of gratitude is in order for the data! Brunswick GA homes for sale
ReplyDeleteWelcome to Hanoi Real Estate Company Full House, we specialize in providing and consulting free houses, villas, apartments in all districts in Hanoi. Long Bien house for rent
ReplyDeleteEvery week-end I used to pay a fast visit this site, because I’d like enjoyment, because this web site conations certainly fussy material.
ReplyDeletewww.americanrealpm.com
A discussion with the local planning office or planning officer can put you on the right track and explain any current issues or matters that may arise. In this process, it is wise to keep records of the discussions and the findings.Find Out More
ReplyDeleteA fascinating dialog is value remark. I feel that it is best to compose more on this matter, it may not be an unthinkable theme however generally people are insufficient to chat on such subjects. To the following. Salud. https://www.valsqld.com.au/
ReplyDeleteTherefore, we should begin by forecasting rental income and the appreciation of the property in consideration.Fix Flip Loans New Jersey
ReplyDeleteThat gives off an impression of being fabulous anyway i am still not very beyond any doubt that I like it. At any rate will look much more into it and choose by and by! Core City Centre
ReplyDeleteProperty documentation reflecting on all types of occupancy should be sourced. This documentation is typically leases, occupancy licences, and side agreements with the tenants. real estate practice test
ReplyDeleteThe article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting. House for Sale
ReplyDeleteThank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me. Ann Arbor Apartments
ReplyDeleteGreat article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks plots for Sale
ReplyDeleteOnly strive to mention one's content can be as incredible. This clarity with your post is superb! Thanks a lot, hundreds of along with you should go on the pleasurable get the job done. Property Maintenance
ReplyDeleteExtraordinary things you've generally imparted to us. Simply continue written work this sort of posts.The time which was squandered in going for educational cost now it can be utilized for studies.Thanks Choose a handyman or contractor
ReplyDeleteYou have made some decent points there. I looked on the internet for more information about the issue and found most people will go along with your views on this web site. raleigh gutters
ReplyDeleteOne present why galore businesses opt for postcards is because they are overmuch cheaper to be prefab and this can forbear a lot of expenses on the lengthened run. Install New gutters
ReplyDeleteThis is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information... Affinity at Serangoon by Oxley
ReplyDeleteIt is the best portal to pay bills online within minutes without any complications. It avails maximum possible flexibility to users to complete their tasks in real quick time. Apart from bill payments it also avails most popular and reputed brands products to customers in affordable prices. PayTM came into existence in 2010. Real Estate Blog
ReplyDeleteWhen should an association consider leading an intellectual property review? Protecting intellectual property rights
ReplyDeleteThis is exactly what I was looking for. Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this! North Carolina Gutter Contracting company
ReplyDeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! ChoreRelief
ReplyDeleteHello, this weekend is good for me, since this time i am reading this enormous informative article here at my home. Enbloc Sale Collective Sale
ReplyDeleteCorrect maintenance will invariably save you money in the long term. The cost of maintenance can be dwarfed when compared to the capital cost of having to install an entire new system after an irrevocable breakdown. commercial property gas safety certificates
ReplyDeleteProperty Services are about providing you with a welcoming and well-maintained building today, and about securing the value of your property for tomorrow and the future. Read More Company Name = Auction Properties UK Phone = 08000246216 Address = 183 Meanwood Road, Leeds, West Yorkshire, LS7 1NB. auction house in leeds
ReplyDeleteIt is interesting to note that tenancy schedules are notoriously incorrect and not up to date in many instances. duplex for sale ocala fl
ReplyDeleteIdiotic and additionally trusting people at the same time can be an obstacle, on aged and also fully grown folk assembled also will follow a complication. Age and also embryonic concern together. General Contractor Maryland
ReplyDeleteEarthworm is an important part of the design, the organic waste in the core is decomposed, worms and microorganisms eat, worms will release earthworm tea to make the soil more fertile. garden tower
ReplyDeleteNice post mate, keep up the great work, just shared this with my friendz Las Vegas
ReplyDeletePlease visit our website for apartments for rent in Hanoi: https://houseinhanoi.vn/
ReplyDeletePlease visit our website for apartments for rent in hanoi. We are the leading real estate agency in Hanoi.
ReplyDeleteAre you looking for apartments for rent in Ciputra Hanoi? Let us help you out!
ReplyDeleteVinhomes Metropolis apartments are the most livable compound in Hanoi CBDs at the moment. Please check it now
ReplyDeleteDecent information picking up article. This post is truly the best on this profitable subject. CBD (cannabidiol) oil
ReplyDeleteInterestingly Budapest is divided up into 23 districts which are marked by Roman numerals. Just under two million people live in Budapest, though there are more than three million inhabitants of Greater Budapest. Rent in Budapest
ReplyDeleteApart from your house, you can also go for this marble flooring for commercial places. Piedra Blanca
ReplyDeleteFoot ferries - This is a kind of cable ferry used to transport passengers and often, cyclists across the river. They are only small in size. fethiye rodos feribot
ReplyDeleteYour blog designs and settings are awesome. keep sharing these types of informative blog site.
ReplyDeletehttps://123movies.mom/
Thank you for your great article. Let's visit our <a hrep="https://jackierealtor.vn/for-rent/sunshine-city-apartments/>Apartments for rent in Sunshine City</a>
ReplyDeleteThank you for your great article. Let's visit our Apartments for rent in Sunshine City
ReplyDeleteWhy don't you find one of villas to rent in Ciputra?
ReplyDeleteLet's see the most expensive D'. Palais Louis project in Hanoi.
ReplyDeleteWhere is the best selling real estate project in Hanoi? Learn more at SUNSHINE GREEN ICONIC
ReplyDeleteAre you looking for villas for rent in Hanoi? Let's check these out!
ReplyDelete- Villas for rent in Ciputra
- Villas for rent in Vinhomes Riverside
- <a hrep="https://jackierealtor.vn/for-rent/villas-in-starlake-tay-ho-tay/>Villas for rent in Starlake</a>
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! property developers in dubai
ReplyDeleteNice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. apartments for rent in Ann Arbor
ReplyDeleteAre you looking for a high-end apartment for rent in Hanoi? Check this Vinhomes Metropolis' collection!
ReplyDeleteStarlake Tay Ho Tay is the most desirable to live in Hanoi. Find your real homes at Starlake apartment & Starlake villa
ReplyDeleteAre you looking for an accommodation to rent in Ciputra Hanoi? Check some options at:
ReplyDelete1. Ciputra apartment
2. Ciputra villa
Please visit our website for apartments for rent in ciputra
ReplyDeleteReally useful for my work. Thank you for sharing. Serviced apartment in Tay Ho
ReplyDeleteEl Dorado apartment, Westlake Hanoi should be one of the best buildings to stay
ReplyDelete