Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
| Search | Today's Posts | Mark Forums Read
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 17th, 2005, 06:10 PM
Registered User
 
Join Date: Nov 2005
Location: Harlingen, Texas, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Link Problems with"unresolved external symbols"

:(When I task built the program described in Chapter 2 of Introduction to Visual C++ 6.0 by Ivor Horton (Document X03-58736-0598), pp 64-65;71-72, I had several problems with the compilation. I have 20 Lnk2001 error messages for various symbols. Most of the symbols, like __imp__DrawTextA@20 and __imp__DispatchMessageA@4 start with __imp__ as a prefix. Whee I look up each symbol after discarding the prefix, I am told that I have to import user32.lib. ;)

THE QUESTION: How do I include this library? Describe, as best as you can, the button clicks that get me where I need to go so that I can fill in the blanks that fix things.

Thanks

Clayton E. Benignus
  #2 (permalink)  
Old November 17th, 2005, 10:34 PM
Registered User
 
Join Date: Nov 2005
Location: Harlingen, Texas, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, I was able to accidentally solve the problem on my own. To tell the truth, I get a little bit absent minded about these fixes, so I'm going to record this fix here in case it comes up again:

1) When you discover what libraries you need, put their headers at the beginning of the program.

Example:
#include "stdafx.h"
#include "winuser.h"
#include "wingdi.h"
#include <ios.h>
#include <tchar.h>

2)Set the parameters:
     Project=>Settings=>General
     ;)In General, make sure the Microsoft Foundation Classes has
         the appropriate entry. In my case, it was "Use MFC in a
         shared DLL"

3) Project=>Settings=>Link
     ;)In Object/Library Modules, list the libraries. In may case,
     they were: user32.lib gdi32.lib .

That got rid of 98% of my compile problems. I am still having problems with:

MSVCRTD.lib(crtexe.obj):error LNK2001: unresolved external symbol _main

However, I got rid of most of the problems. I'll be researching this problem next.I may post on this later.
  #3 (permalink)  
Old November 22nd, 2005, 06:34 AM
Registered User
 
Join Date: Nov 2005
Location: chennai, TN, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In vc++ you can add libraries by,
  Project>settings>link>projectoption....type the name of the library you want to have.

If you want to add the library folder to your application,
 Tools>options>directories>show directories for(select library) then double click the empty entry to browse and add your library folder

Regards,
HARI R


Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 14 - Link Error - Unresolved Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 March 18th, 2008 06:44 PM
Access external link to Excel in Sharepoint wortinguk Access 1 October 20th, 2006 10:32 AM
Unresolved External Symbol - LNK2019 Valke Visual C++ 2005 1 April 14th, 2006 02:44 PM
error LNK2019: unresolved external symbol tinawalt VS.NET 2002/2003 3 August 9th, 2005 07:59 AM
Relative Link to External Style Sheet arduk ASP.NET 1.0 and 1.1 Basics 1 June 18th, 2003 09:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.