locked
Upgrading VC++ Project from VS2008 to VS2010 Got Unresolved Externals! RRS feed

  • Question

  • I converted a VS2008 VC++ project to VS2010 and compiled, but got an Unresolved External Error as follows:

    "1>libcmtd.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup"

    I checked the project properties, they seems to be OK, there was no entry point specified. Does anybody have any idea what goes wrong? Any suggestion or tips are welcome and appreciated.

    Anthony

    Wednesday, April 13, 2011 12:13 PM

All replies

  • I converted a VS2008 project to VS2010 and compiled, but got an Unresolved External Error as follows:

    "1>libcmtd.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup"

    I checked the project properties, they seems to be OK, there was no entry point specified. Does anybody have any idea what goes wrong? Any suggestion or tips are welcome and appreciated.

    Anthony

    • Moved by eryang Thursday, April 14, 2011 5:10 AM (From:Visual Studio Debugger)
    • Merged by Rob Pan Friday, April 15, 2011 7:09 AM the same thread
    Wednesday, April 13, 2011 4:05 AM
  •  there was no entry point specified.

    Go to Project Properties/Linker and set wWinMainCRTStartup as the Entry Point.



    Knowledge is like light; It spreads only when you have clear and transparent mind.
    Wednesday, April 13, 2011 12:36 PM
  • Dear D.Sreedhar,

    Thank you for your suggestion. I tried to set the Entry Point to wWinMainCRTStartup and compiled again, but the error message was still  the same as follows:

    "1>libcmtd.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup"

    When I set the Entry Point to ____tmainCRTStartup and compiled again, the error message was as follows:

    "1>LINK : error LNK2001: unresolved external symbol ____tmainCRTStartup
    1>libcmtd.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup"

    Any suggestions or tips are welcome and greatly appreciated.

    Thanks.

    Anthony




    • Edited by Anthony66888 Friday, April 15, 2011 7:52 AM Re-posted
    Thursday, April 14, 2011 12:24 AM
  • I move this thread to C++ forum for better support.
    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 14, 2011 5:10 AM
  • Hi,

     

      Based on my knowledge, This error  happens if you’re compile/run a Windows app that has a WinMain function, but you chose “Console Application” INSTEAD of “Windows Application”. Please follow these steps to fix this error,

    1. Right-click your project node, and select Properties.

    2. Expand Linker option, click System.

    3. Select the right option in SubSystem.

     

    I hope my suggestion can help you to resolve your issue. If anything is unclear, please feel free and let me know.

     

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Rob Pan Tuesday, April 26, 2011 1:16 AM
    • Unmarked as answer by Rob Pan Tuesday, May 3, 2011 1:32 AM
    • Proposed as answer by Vishg14 Thursday, May 10, 2012 11:02 AM
    Tuesday, April 19, 2011 3:14 AM
  • Hi, Rob,

    Thanks for your suggestion. I was away for some time without visiting the forum.

    I checked my project properties, under the Linker node, The "SubSystem" option was "Windows (SUBSYSTEM: WINDOWS)". There are no any other option more appropriate for my project. But it still compiled with the same linker error.

    I tried to set the target versions to x0501 (WINXP) or higher, But it still compiled with the same linker error.

    I tried to install Windows SDK 7.1 and VS2010 SP1 with Compiler Update, but it still compiled with the same linker error.

    Any idea or suggestions are welcome and greatly appreciated.

     

    Anthony

    Tuesday, May 3, 2011 1:28 AM
  • Hi Anthony,

     

    You can create a console project like “Hello world” to test the environment setting of  Visual Studio.

     

    If you  still have this error, you can post your project or sample to us. So we can reproduce this error and help you to resolve this error. If anything is unclear, please feel free and let me know.

     

    Best Regards,

    Rob

     


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 3, 2011 9:38 AM
  • Hi Rob,

     

    Thanks for your suggestions. I created a "Hello, World!" console project in VS2010, it compiled and worked well. I also created one console and one MFC application (Hello, World) in VS2008 and then upgraded them to VS2010, They also compiled and worked well in VS2010.

    I am wondering what happened to my own VC++ MFC Windows Application project which compiled well in VS2008 but compiled with Unresolved External in VS2010 for the main function while there is no any main function in my project?

     

    Thanks,

    Anthony

    Wednesday, May 4, 2011 4:07 AM
  • Hi Anthony,

     

    Have your add all your library into  Visual Studio 2010. You can check the library in Linker->Input->Additional Dependencies.

     

    If you still have this issue, please try to set Project Properties->General->Platform Toolset to v90 in Visual Studio 2010. Pay attention that  you need to install both Visual Studio 2008 and 2010.

     

    If you don’t mind, can you post me a sample which compiled with Unresolved External in VS2010.

     

    I’m glad to receive your reply, and help you to resolve your issue. If anything is unclear , please feel free and let me know.

     

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 4, 2011 8:31 AM
  • Hi Rob,

    Thanks for the reply. I check the libraries, they are all added. They are:

    opengl32.lib
    glu32.lib
    comctl32.lib
    Winmm.lib
    vfw32.lib
    psapi.lib
    Gdiplus.lib

    When I converted the project, I got two warnings. They are:

    VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.

    Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.

    The project is too big to be sent. I will try whether I can re-produce the problem with a small project with the same libraries.

    Anthony

     

    Wednesday, May 4, 2011 9:21 AM
  • Hi Anthony,

    They are warnings, and Visual Studio has corrected these warnings. Here is information about upgrade Visual Studio 2010. http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

     

    Could you please tell me whether you have resolved your issue?

    I'm glad to receive your reply and help you.

     

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 10, 2011 8:16 AM
  • Hi, Rob,

     

    I am still not able to solve the problem. I installed VS2008 and set the "Platform Toolset" to v90 and compiled again, but still got the same "unresolved external" error. I think the problem is something related with "libcmtd.lib(wwincrt0.obj)".

     

    Anthony

    Tuesday, May 17, 2011 10:42 AM
  • Anthony can you try to upgrade your project through command line ?

    devenv /Upgrade

    and build it from command line

     


    मनोज कुमार जांगिड [manojjangid@hotmail.com] skype - jangid
    Tuesday, May 17, 2011 11:03 AM

  • Hi, Rob,

    Thanks for your suggestion. I was away for some time without visiting the forum.

    I checked my project properties, under the Linker node, The "SubSystem" option was "Windows (SUBSYSTEM: WINDOWS)". There are no any other option more appropriate for my project. But it still compiled with the same linker error.

    I tried to set the target versions to x0501 (WINXP) or higher, But it still compiled with the same linker error.

    I tried to install Windows SDK 7.1 and VS2010 SP1 with Compiler Update, but it still compiled with the same linker error.

    Any idea or suggestions are welcome and greatly appreciated.

     

    Anthony

    Can you check with _tWinMain syntax.

    WinMainCRTStartup is for Non-Unicode

    wWinMainCRTStartup is for Unicode which will link with _UNICODE linker switch.


               The LNK2019 with entry point, but I think I have it right discuss about this.


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/
    Tuesday, May 17, 2011 11:08 AM
  • Hi, Salvam, Rob and Jangid,

     

    Thank you all for your suggestions. The problem was with the UNICODE character set, it compiled OK when I changed to MBCS. However the program failed to create the frame window. The code is as follows:

    // create main MDI Frame window
     CMainFrame* pMainFrame = new CMainFrame;
     if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
     {
      delete pMainFrame;
      DWORD dwError = GetLastError();
      return FALSE;
     }

    The program failed at "delete pMainFrame;" The error message was:

    Unhandled exception at 0x004bcd3c in XXX.exe: 0xC0000005: Access violation reading location 0xfeeefef2.

    I checked pMainFrame, it had a valid address but with an unknown window handle m_hWnd (???). The window was not created.

    I have both _T("") and L"" string literals in my code. The program compiled OK using either UNICODE or MBCS in VS2008 and ran well. I am wondering wether there is any major change from VS2008 to VS2010 regarding UNICODE/MBCS?

    Any tips and suggestions are welcome and greatly appreciated.

     

    Anthony

     

    Wednesday, May 18, 2011 4:33 AM
  • I checked pMainFrame, it had a valid address but with an unknown window handle m_hWnd (???). The window was not created.

    I have both _T("") and L"" string literals in my code. The program compiled OK using either UNICODE or MBCS in VS2008 and ran well. I am wondering wether there is any major change from VS2008 to VS2010 regarding UNICODE/MBCS?


    You should use TEXT("") or _T("") string literal for work both MBCS and Unicode. The L"" string literal for unicde strings.                                                                                                  

    Or

    You can use char string for work in MBCS. Don't use L"" string literals.


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/
    Wednesday, May 18, 2011 4:39 AM
  • Hi Rob,

    Thank you very much...Your suggested option could fix my problem..!

    Thank u!

    Thursday, May 10, 2012 11:02 AM