Unauthorized external characters __RTC_ * in Windows Programming Tutorial

Using Visual Studio Express 2010, I made a Windows project with the Windows Application and Empty Project options. Then I tried the following code snippet from the Windows MSDN tutorials:

#include <windows.h>
#include <shobjidl.h> 

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | 
        COINIT_DISABLE_OLE1DDE);
    if (SUCCEEDED(hr))
    {
        IFileOpenDialog *pFileOpen;

        // Create the FileOpenDialog object.
        hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_ALL, 
                IID_IFileOpenDialog, reinterpret_cast<void**>(&pFileOpen));

        if (SUCCEEDED(hr))
        {
            // Show the Open dialog box.
            hr = pFileOpen->Show(NULL);

            // Get the file name from the dialog box.
            if (SUCCEEDED(hr))
            {
                IShellItem *pItem;
                hr = pFileOpen->GetResult(&pItem);
                if (SUCCEEDED(hr))
                {
                    PWSTR pszFilePath;
                    hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);

                    // Display the file name to the user.
                    if (SUCCEEDED(hr))
                    {
                        MessageBox(NULL, pszFilePath, L"File Path", MB_OK);
                        CoTaskMemFree(pszFilePath);
                    }
                    pItem->Release();
                }
            }
            pFileOpen->Release();
        }
        CoUninitialize();
    }
    return 0;
}

I got the following errors:

1>------ Rebuild All started: Project: Test05, Configuration: Debug Win32 ------
1>  Test05.cpp
1>Test05.obj : error LNK2019: unresolved external symbol @_RTC_CheckStackVars@8 
referenced in function _wWinMain@16
1>Test05.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in 
function _wWinMain@16
1>Test05.obj : error LNK2001: unresolved external symbol __RTC_Shutdown 
1>Test05.obj : error LNK2001: unresolved external symbol __RTC_InitBase
1>LINK : error LNK2001: unresolved external symbol _wWinMainCRTStartup

What's going on here? Best of all I can say to do something with wWinMain, but it is copied directly from the site.

, , , . Visual ++, ( , ), Visual ++, , (, , ), , , , .

+5
3

_RTC_xxx "Basic Runtime Checks"; , " " > "C/++" > " " > " " " ". , , , C-Runtime.

+4

, , , .

, , ​​ Visual Studio .

, Visual Studio, , - .

0

I would download the full sample code from the link here , and not copy and paste this piece of code that you contacted. Project files may contain important compiler / linker settings that are not displayed there. The sample is the VS 2008 solution, but I was able to upgrade it to the 2010 solution and build it. However, this gave me a "fatal linker error: could not find" kernel32.lib "when I tried to build it in VS 2008.

0
source

All Articles