作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我使用 Visual Studio Express 2010 创建了一个 Windows 项目,其中包含 Windows Application 和 Empty Project 选项。然后我尝试了 following code snippet来自 MSDN Windows 教程:
#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;
}
我遇到了以下错误:
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
这是怎么回事?最好我能说出与 wWinMain
有关的事情,但它是直接从站点复制的。
编译器对我来说似乎比学编程麻烦多了。在尝试了其他几个(主要是代码块)之后,我决定使用 Visual C++,但是由于 Visual C++ 似乎得到了最多的支持(或者至少是大多数用户),我认为它总比没有得到要好,因为它们都太不直观了初学者。
最佳答案
使用'Basic Runtime Checks'时添加了_RTC_xxx符号;要禁用它们,您可以继续项目属性,并将 Configuration Properties>C/C++>All Options>Basic Runtime Checks 选项设置为“Default”。虽然,如其他答案中所述,您的 C 运行时库似乎不匹配。
关于c++ - Windows编程教程中未解析的外部符号__RTC_*,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10158013/
我是一名优秀的程序员,十分优秀!