locked
WM6 SDK make ambiguous function call RRS feed

  • Question

  • Dear all,

    I am using VC++2008, and after install Windows Mobile 6 SDK. I found that some function (such as wvsprintfW) are defined in both WM6 SDK and VC2008, it make ambiguous call in my application.

    If I need to create a program for WM6, how should I do? How to make VC2008 only use WM6 SDK, not use standard WinCE library?


    1>..\..\..\VS2008\xWFDebug\xWFDebug\src\DebugI.cpp(140) : error C2668: 'wvsprintfW' : ambiguous call to overloaded function
    1>        C:\Program Files\Windows Mobile 6 SDK\PocketPC\include\ARMV4I\winbase.h(747): could be 'int wvsprintfW(LPWSTR,LPCWSTR,va_list)'
    1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\atlmfc\include\atlosapice.h(901): or 'int ATL::wvsprintfW(wchar_t *,const wchar_t *,va_list)'
    1>        while trying to match the argument list '(TCHAR [1024], LPCTSTR, va_list)'
    

    Thank you.
    Kevin Tang
    Thursday, January 7, 2010 2:48 AM

Answers

  • Hi,

    Please try to use
        ::wvsprintf(szBuf, lpszFmt, args);   

    Hope it helps,
    Zhe Zhao
    • Marked as answer by ZHE ZHAO Wednesday, January 13, 2010 4:46 AM
    Monday, January 11, 2010 9:01 AM

All replies

  • Did you make sure to create a C++ Smart Device Application? If so, did you also make sure that you are targeting the WM6 (Standard / Pro) SDK and remove all other SDKs when walking through the smart device project wizzard?
    Thursday, January 7, 2010 10:03 AM
  • Sure, I have created MFC SmartDevice DLL project, and select WM6 Professional as target device only. Inside my code, I create a function as bellow:
    void PrintMsgBox(LPCTSTR lpszFmt, ...)
    {
    	va_list args = NULL;							
    	TCHAR szBuf[10240] = {0};						
    	va_start(args, lpszFmt);  
    	wvsprintf(szBuf, lpszFmt, args);		// call this to interperte the printing of arglist
    	AfxMessageBox(szBuf);
    }
    

    When compile my program, it always have "error C2668: 'wvsprintfW' : ambiguous call to overloaded function".

    Thursday, January 7, 2010 10:40 AM
  • Hi,

    Please try to use
        ::wvsprintf(szBuf, lpszFmt, args);   

    Hope it helps,
    Zhe Zhao
    • Marked as answer by ZHE ZHAO Wednesday, January 13, 2010 4:46 AM
    Monday, January 11, 2010 9:01 AM