Click here to Skip to main content
15,891,905 members
Articles / Desktop Programming / WTL
Article

Using WTL with Intellisense

Rate me:
Please Sign up or sign in to vote.
3.38/5 (11 votes)
24 Dec 20033 min read 53.9K   512   15   6
Normally, Intellisense doesn't work correctly with WTL. Here is a workaround.

Introduction

After deciding that MFC was too bloated for my liking, I discovered WTL. I read the various articles on CodeProject about them, and was eager to try this excellent new wrapper for Win32. (Imagine... no support files necessary!)

Unfortunately, I soon discovered that my favorite part of Visual Studio, Intellisense, didn't work correctly. I was frustrated by this, because I am a heavy Intellisense user. Throughout the course of my frustration, I decided to buy Visual C++ .NET 2003. (I had VC2002 initially.) When that didn't solve my problems, although it relieved a few unrelated ones, I decided to try to find another way.

In actuality, I had a solution ready in 5 minutes. I got an idea from someone who said they included all of the WTL header files in their project. I thought that was messy, and decided to try including them in a static library. The library itself doesn't do anything special.

There may be other solutions, and if you have one, feel free to post so I can update the article accordingly. But I decided to write my first article for this, since it has helped me and hopefully will help others.

Included Source Files

In the source files linked at the top of this article, you will find a Static Library. If you don't wish to follow the steps below, you can download the source ZIP and skip to step 4. NOTE: It was created in VS2003, and uses the WTL 7.1 headers.

A Workaround

  • Step 1: Create a new Win32 Project. I used "WTL71Intellisense" for the project name, because that is the version of WTL I am using. Select "Static Library" under "Application Settings". The rest remain at their default. (Precompiled Headers, no MFC)
  • Step 2: Right-click on the Project name in Project Explorer. Choose "Add" > "Add Existing Item". Navigate to the '(WTL)\include' directory that you keep your WTL headers in. Select all of the items, and add them to the project.
  • Step 3: Make sure you are in Release mode, and build the library. If all goes well, your library should build. Go to the "Release" directory, and find the .lib file.
  • Step 4: Place the .lib file in your Library directory. Mine is C:\Program Files\Visual Studio Projects\vc7\lib directory. (with VS2003. With other installs yours may be different)

You're done! To use the library:

  • Step 1: Right-click on the Project name in Project Explorer. Choose "Properties", and go to the "Linker" tab, subsection "Input". Select "All Configurations".
  • Step 2: In the "Additional Dependencies", add the name of the library file. (e.g. WTL71Intellisense.lib)

Intellisense should now work correctly.

Notes

  • Especially with MFC projects, as with any WTL project, be careful about name collisions in your code.
  • You don't need to change anything else in your project besides linking in the library.
  • Linking the library should not affect your executable.
  • If you change the WTL source files, it would be wise to rebuild the library project.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralWorkaround to let IntelliSense work with any user-defined headerfile Pin
Troubelman19-Jan-05 21:41
Troubelman19-Jan-05 21:41 
GeneralExellent! Pin
Ernesto D.27-Nov-04 22:30
Ernesto D.27-Nov-04 22:30 
GeneralSimpler solution for VC 6.0 Pin
weelink15-Jan-04 3:17
weelink15-Jan-04 3:17 
GeneralSome advertising... Pin
Ralph Wetzel25-Dec-03 0:59
Ralph Wetzel25-Dec-03 0:59 
GeneralRe: Some advertising... Pin
WREY1-Jan-04 15:34
WREY1-Jan-04 15:34 
Yes, you're right. The tool does have many benefits. But the tool is only as good as the people behind it, and my observation on that point is, the success of the product has emboldened them with an air of "cockiness" and "arrogance". This due to their hearing from so many of its users, "how great the product is" (pretty much what you have just stated).

Yes, they give you this whitewash about, "always looking for ways to improve the product," while on the other hand, releasing the software with KNOWN deficiencies which they gloss over as trade-offs between response and extra CPU cycles that would be required to correct it.

IOW, they have become just like giant software manufacturers that release software to the public with KNOWN defects. ITM, you better be nice to them when complaining about the problem (not to forget that you didn't get the software for FREE), otherwise you run the risk of them revealing how "unappreciative" they can be about what you have to say. (If you think I'm making all this up, ask Christian Grauss about his encounter with them also.)

I am not talking about the product as much as I'm talking about the people behind the product!! They are the ones who decide what gets released and what doesn't!!

Poke tongue | ;-P

William

Fortes in fide et opere!
GeneralRe: Some advertising... Pin
Ralph Wetzel2-Jan-04 0:50
Ralph Wetzel2-Jan-04 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.