CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2010
    Posts
    18

    Question LINK error: LNK2001: unresolved external symbol

    hi ,

    i am using MSDN library functions in my c file. I want to create a GUI using some of the following functions like
    CreateWindowEx
    ShowWindow
    AdjustWindowRect
    LoadCursor
    SetWindowPos
    CreatePen
    TextOut
    LineTo
    MoveToEx etc....

    but whn i build the project i'm getting link error while creating .obj file for all of the functions which ever i'm using.
    the errors are like:

    error LNK2001: unresolved external symbol __imp__GetMessageA@16
    win.obj : error LNK2001: unresolved external symbol __imp__SetTimer@16
    win.obj : error LNK2001: unresolved external symbol __imp__UpdateWindow@4
    win.obj : error LNK2001: unresolved external symbol __imp__ShowWindow@8
    win.obj : error LNK2001: unresolved external symbol __imp__SetWindowPos@28
    like this fr all of the functions which are used...




    if anyone cm across these type of problems plz help...
    Last edited by shri1609; May 2nd, 2010 at 11:45 PM.

  2. #2
    Join Date
    May 2010
    Posts
    2

    Re: LINK error: LNK2001: unresolved external symbol

    try add #include<windows.h> in your source file
    check whether or not linked all needed dll

  3. #3
    Join Date
    Feb 2010
    Posts
    18

    Re: LINK error: LNK2001: unresolved external symbol

    hi.

    ya i ve included these all
    #include <windows.h>
    #include <winbase.h>
    #include <DDraw.h>

    can u plz tell who to check all dll r linked or not....

  4. #4
    Join Date
    Apr 2008
    Posts
    133

    Re: LINK error: LNK2001: unresolved external symbol

    Perhaps it has to do with some calling conventions mismatch since you are using this in a C file but the linker output seems to indicate some different calling convention leading to mangling of the API names. Maybe you can move this code to a c++ file and test if it works there

  5. #5
    Join Date
    Feb 2010
    Posts
    18

    Re: LINK error: LNK2001: unresolved external symbol

    thnks fr tht sujection but i cant move tat part to c++.. its part of a huge application which has to run in c only... and one more thing i 'm using VC++ 6.0 fr this app...
    Last edited by shri1609; May 3rd, 2010 at 03:59 AM.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: LINK error: LNK2001: unresolved external symbol

    Quote Originally Posted by shri1609 View Post
    hi.

    ya i ve included these all
    #include <windows.h>
    #include <winbase.h>
    #include <DDraw.h>

    can u plz tell who to check all dll r linked or not....
    It's really hard to take you seriously when you write like a three year old.

  7. #7
    Join Date
    Feb 2010
    Posts
    18

    Re: LINK error: LNK2001: unresolved external symbol

    so plz can u tell how to write latest technique .....

  8. #8
    Join Date
    Feb 2010
    Posts
    18

    Re: LINK error: LNK2001: unresolved external symbol

    any one can help to resolve this prob.....

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: LINK error: LNK2001: unresolved external symbol

    Quote Originally Posted by shri1609 View Post
    so plz can u tell how to write latest technique .....
    Did you learn in the school?
    Does your keyboard work properly?
    Victor Nijegorodov

  10. #10
    Join Date
    Feb 2010
    Posts
    18

    Re: LINK error: LNK2001: unresolved external symbol

    @GCDEF and @VictorN
    if ur elite member of this forum thn it doesn't mean u can reply any way...
    as i'm new to VC++ programming , i needed some clarification about the bug which im facing...
    for that you cant reply like this... if u dont want to help thn leave it, who told to reply you plp...
    sorry for comments...

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: LINK error: LNK2001: unresolved external symbol

    Quote Originally Posted by shri1609 View Post
    @GCDEF and @VictorN
    if ur elite member of this forum thn it doesn't mean u can reply any way...
    as i'm new to VC++ programming , i needed some clarification about the bug which im facing...
    for that you cant reply like this... if u dont want to help thn leave it, who told to reply you plp...
    sorry for comments...
    Or perhaps you could follow the posting guidelines of the forum. From the "Before you post" sticky.

    Use real grammer. If you use things like "u r gr8", you are going to be seen as unprofessional. Worse, many of the people who speak English as a second language may not understand what you are saying -- and thus won't be able to respond.

    Believe it or not, letting you know that writing like that won't get you far in the real world is helping - just not the help you're looking for right now I guess.

  12. #12
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LINK error: LNK2001: unresolved external symbol

    Quote Originally Posted by shri1609 View Post
    @GCDEF and @VictorN
    if ur elite member of this forum thn it doesn't mean u can reply any way...
    as i'm new to VC++ programming , i needed some clarification about the bug which im facing...
    for that you cant reply like this... if u dont want to help thn leave it, who told to reply you plp...
    sorry for comments...
    Please write proper English. This forum is a professional programming forum, not Facebook, so writing proper English, or at least attempt to write proper English, is what is expected here. There are persons reading this thread whose first language is not English, and writing text message nonsense doesn't help those persons understand what's going on.

    Secondly, those are linker errors. This means you are not linking the Windows libraries such as kernel32, user32, etc. It is very hard to get that error if you are using Visual Studio and just create a Win32 project, since a project knows to link in the correct Windows libraries.

    So how did you set up your application? Are you using Visual Studio, and if so, what project did you select?

    Regards,

    Paul McKenzie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured