【发布时间】:2012-10-15 10:04:27
【问题描述】:
我的 C++ 代码,它是 Media Foundation Transform 的一部分,往往能够在 Windows Store App (Metro) 中运行
我修改C++ GrayscaleTransform 以包含以下代码。
但是,我的 C++ 代码无法找到命名空间 Windows::Storage。
LPCWSTR zPath = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data();
我需要做任何额外的设置吗?
我可以通过打开使用 Windows 运行时扩展来编译它。
但是这样做,它会给我额外的链接错误和警告。
warning LNK4197: export 'DllGetActivationFactory' specified multiple times; using first specification
warning LNK4197: export 'DllCanUnloadNow' specified multiple times; using first specification
warning LNK4197: export 'DllGetActivationFactory' specified multiple times; using first specification
warning LNK4197: export 'DllCanUnloadNow' specified multiple times; using first specification
error LNK2005: _DllCanUnloadNow@0 already defined in dllmain.obj
error LNK1169: one or more multiply defined symbols found
注释掉DllCanUnloadNow会产生运行时错误。
我在运行时中断
// GrayscaleTransform.dll!Microsoft::WRL::Details::ModuleBase::ModuleBase() Line 155 + 0x46 bytes C++
ModuleBase() throw()
{
#ifdef _DEBUG
// This indicates that there were two instances of the module created or race conditon during module creation
// If you are creating object with new/delete please make sure that you haven't created more than one module
// and you disabled static initalization with __WRL_DISABLE_STATIC_INITIALIZE__
// otherwise please initialize/create module in main()
__WRL_ASSERT__(::InterlockedCompareExchangePointer(reinterpret_cast<void* volatile*>(&module_), this, nullptr) == nullptr &&
"The module was already instantiated");
SRWLOCK initSRWLOCK = SRWLOCK_INIT;
__WRL_ASSERT__(reinterpret_cast<SRWLOCK*>(&moduleLock_)->Ptr == initSRWLOCK.Ptr && "Different value for moduleLock_ than SRWLOCK_INIT");
(initSRWLOCK);
#else
module_ = this;
#endif
}
【问题讨论】:
标签: c++ visual-studio visual-c++ windows-8 windows-runtime