none
error LNK2019 on eVC4 RRS feed

  • Question

  • I got the following errors when I run my application on the evc4.

    fname.obj : error LNK2019: unresolved external symbol _DefWindowProcA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _CreateFontIndirectA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _LoadImageA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _SendMessageA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _MessageBoxA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _CreateWindowExA referenced in function "long __cdecl WndProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProcedure@@YAJPAUHWND__@@IIJ@Z)

    fname.obj : error LNK2019: unresolved external symbol _DispatchMessageA referenced in function _WinMain

    fname.obj : error LNK2019: unresolved external symbol _PeekMessageA referenced in function _WinMain

    fname.obj : error LNK2019: unresolved external symbol _PlaySoundA referenced in function _WinMain

    fname.obj : error LNK2019: unresolved external symbol _DrawTextA referenced in function _WinMain

    fname.obj : error LNK2019: unresolved external symbol __imp__CreateFileA referenced in function _WinMain

    fname.obj : error LNK2019: unresolved external symbol _RegisterClassA referenced in function _WinMain

    emulatorDbg/fnameEmb.exe : fatal error LNK1120: 12 unresolved externals

    Error executing link.exe.

    Creating browse info file...

    fnameEmb.exe - 13 error(s), 0 warning(s)

    My application iclude these header files:

    #include <stdio.h>

    #include <stdlib.h>

    #include <math.h>

    #include <stdarg.h>

    #include <Windows.h>

    #include <Winuser.h>

    #include <commctrl.h>

    #include <Mmsystem.h>

    #pragma comment(lib, "Winmm.lib")

    #pragma comment(lib, "comctl32.lib")

    #pragma comment(lib, "User32.lib")

    I gathered from threads with similar problem that the cause arises because the compiler cannot find the libraries needed.

    For that, I included the above libs as well as "commctrl.lib" in the same directory as my application. The same application run on VC++ as an API win32 with no glitches. Any idea what could be the cause of the errors? Thanks


    Esmat
    Tuesday, September 13, 2011 3:43 AM

Answers

  • Is this a Unicode issue?  Shouldn't your app be trying to link with the *W library routines?  check that _UNICODE and all its related defines are properly set up in your project settings.
    • Marked as answer by EsmatB Wednesday, September 14, 2011 1:39 AM
    Tuesday, September 13, 2011 1:49 PM

All replies

  • Putting the libs in the project directory doesn't help. You need to specify the library search path in the project settings.
    Tuesday, September 13, 2011 4:53 AM
  • Is this a Unicode issue?  Shouldn't your app be trying to link with the *W library routines?  check that _UNICODE and all its related defines are properly set up in your project settings.
    • Marked as answer by EsmatB Wednesday, September 14, 2011 1:39 AM
    Tuesday, September 13, 2011 1:49 PM
  • I_hart_software, Thank you very much for your answer. I found out that by including UNICODE,_UNICODE in the Project settings C\C++ preprocessor definition cleared the link errors. One remaining question: is it true that all the characters used in an CE application should be of the wide type? Thanks again.
    Esmat
    Wednesday, September 14, 2011 1:43 AM
  • Windows CE provides the API functions that expect PWCHAR arguments, e.g. CreateFile is always CreateFileW. You will have to pass WCHAR strings to these functions. Other functions as inet_addr are defined with a ANSI string parameter and you pass an ANSI string.

    But this does not say anything about your data. You can use any encoding in the data that your store or transfer, ANSI, WCHAR, EBCDIC, or some kind of morse code.

    Wednesday, September 14, 2011 4:25 AM
  • Thank you Andy for your clarifications about the use of WCHAR in the CE routine. This was helpful.
    Esmat
    Wednesday, September 14, 2011 1:43 PM