Windows :: Storage :: ApplicationData ::当前未在C中找到
我的C代码,它是
Media Foundation Transform的一部分,往往能够在Windows应用商店应用(Metro)中运行
我修改C GrayscaleTransform以包含以下代码. 但是,我的C代码无法找到命名空间Windows :: Storage. LPCWSTR zPath = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data(); 我需要做任何其他设置吗? 我可以通过打开Consume Windows Runtime Extension来编译它. 但通过这样做,它将给我额外的链接错误和警告. 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 } 解决方法
发生链接器错误是因为您在GrayscaleTransform项目中启用了C/C++X.您的项目定义了dllmain.cpp中列出的入口点.启用C/C++X时,vccorlib会链接到您的模块,并且还会定义这些入口点.
发生运行时错误是因为vccorlib中的C/C++X基础结构创建了一个模块,并且您的入口点尝试创建另一种模块.模块中只能有一个模块. 您需要对GrayscaleTransform项目进行一些更改才能在其中使用C/C++X: >从dllmain.cpp中删除四个Dll *()函数.您将依赖于从vccorlib链接的定义.请注意,仍然需要类注册(ActivatableClass(CGrayscale)). 请注意,在使用WRL混合C/C++X和“低级”C时需要非常小心.大多数涉及C/C++X类型的表达式都会抛出异常,您必须确保不允许任何异常跨越ABI边界. 或者,考虑不使用C/C++X,而是在整个项目中使用WRL.它将更加冗长,但如果您已经将WRL用于项目的其他部分,则可能更有意义. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 更改windows phone 7 silverlight项目命名空间导
- windows-server-2008 – 基于客户端MAC的Windows
- Windows Phone 7 – 检测到Windows Phone 7上已经
- .net – 用于Windows 8上的开发目的的LDAP服务器
- windows-server-2008-r2 – FileZilla FTP的被动
- windows – COM服务器是否必须为[out]参数调用Sy
- windows – Splunk的替代品?
- Windows Phone 7 – ApplicationBar始终为空
- 纯Win32 C中的自定义菜单边框(没有WTL,MFC等)
- 何时包含.lib以及何时包含.dll或两者