本文介绍了IAsyncOperation BitmapImage ^ C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我试图在c#windows store app项目中创建一个C ++ Runtime组件;



我创建了一个新项目C ++ - > Windows应用商店应用 - > Windows运行时组件。

新项目有默认的class1。

这就是我想要做的:



Class1.h:

  public   ref   class  Class1  sealed  
{
public
Class1();
Windows :: Foundation :: IAsyncOperation< Windows :: UI :: Xaml :: Media :: Imaging :: BitmapImage ^> ^ StreamToBitmap(Windows :: Storage :: Streams :: IRandomAccessStream ^ fileStream);

};
}





Class1.cpp:





 Class1 :: Class1()
{
}

IAsyncOperation< BitmapImage ^> ^ StreamToBitmap(IRandomAccessStream ^ fileStream )
{
return create_async([=]()
{
auto bitmapImage = ref new BitmapImage();
bitmapImage-> SetSource(fileStream);
return bitmapImage;

});

}





错误:



错误2错误LNK2019:未解析的外部符号public:virtual struct Windows :: Foundation :: IAsyncOperation< class Windows :: UI :: Xaml :: Media :: Imaging :: BitmapImage ^> ^ __cdecl TestRuntimeC__toCS :: Class1 :: [TestRuntimeC__toCS :: __ IClass1PublicNonVirtuals] :: LoadImage(struct Windows :: Storage :: Streams :: IRandomAccessStream ^)(?LoadImage @?Q__IClass1PublicNonVirtuals @ TestRuntimeC__toCS @@ Class1 @ 2 @ U $ AAAP $ AAU ?$ IAsyncOperation @ P $ AAVBitmapImage @ Imaging @ Media @ Xaml @ UI @Windows @@@ @@ @ P @ AAUIRandomAccessStream @ Streams @ Storage @ 6 @@ Z)在函数public:virtual long __stdcall TestRuntimeC__toCS ::中引用Class1 :: [TestRuntimeC__toCS :: __ IClass1PublicNonVirtuals] :: __ abi_TestRuntimeC__toCS ___ IClass1PublicNonVirtuals ____ abi_LoadImage(struct Windows :: Storage :: Streams :: IRandomAccessStream ^,struct Windows :: Foundation :: IAsyncOperation< class Windows :: UI :: Xaml :: Media :: Imaging: :BitmapImage ^> ^ *)(?__ abi_TestRuntimeC__toCS ___ IClass1PublicNonVirtuals ____ abi_LoadImage @?Q__IClass1PublicNonVirtuals @ TestRuntimeC__toCS @@ Class1 @ 2 @ U $ AAGJP $ AAUIRandomAccessStream @ Streams @ Storage @Windows @@ PAP $ AAU?$ IAsyncOperation @ P $ AAVBitmapImage @ Imaging @ Media @ Xaml @ UI @ Windows @@@ Foundation @ 7 @@ Z)C:\ Users\Stamatis \Documents\Visual Studio 2013 \Projects\TestRuntimeC ++ toCS\TestRuntimeC ++ toCS\Class1.obj TestRuntimeC ++ toCS 
解决方案




Im trying to create a C++ Runtime compoment to use in c# windows store app project;

I Created a new project C++ -> Windows Store App -> Windows Runtime Component.
The new project has default class1.
This is what i m trying to do:

Class1.h:

public ref class Class1 sealed
	{
	public:
		Class1();
                Windows::Foundation::IAsyncOperation<Windows::UI::Xaml::Media::Imaging::BitmapImage^>^ StreamToBitmap(Windows::Storage::Streams::IRandomAccessStream^ fileStream);

	};
}



Class1.cpp:


Class1::Class1()
{
}

IAsyncOperation<BitmapImage^>^ StreamToBitmap(IRandomAccessStream^ fileStream)
{
	return create_async([=]()
	{
		auto bitmapImage = ref new BitmapImage();
		bitmapImage->SetSource(fileStream);
		return bitmapImage;

	});

}



Errors:

Error	2	error LNK2019: unresolved external symbol "public: virtual struct Windows::Foundation::IAsyncOperation<class Windows::UI::Xaml::Media::Imaging::BitmapImage ^> ^ __cdecl TestRuntimeC__toCS::Class1::[TestRuntimeC__toCS::__IClass1PublicNonVirtuals]::LoadImage(struct Windows::Storage::Streams::IRandomAccessStream ^)" (?LoadImage@?Q__IClass1PublicNonVirtuals@TestRuntimeC__toCS@@Class1@2@U$AAAP$AAU?$IAsyncOperation@P$AAVBitmapImage@Imaging@Media@Xaml@UI@Windows@@@Foundation@Windows@@P$AAUIRandomAccessStream@Streams@Storage@6@@Z) referenced in function "public: virtual long __stdcall TestRuntimeC__toCS::Class1::[TestRuntimeC__toCS::__IClass1PublicNonVirtuals]::__abi_TestRuntimeC__toCS___IClass1PublicNonVirtuals____abi_LoadImage(struct Windows::Storage::Streams::IRandomAccessStream ^,struct Windows::Foundation::IAsyncOperation<class Windows::UI::Xaml::Media::Imaging::BitmapImage ^> ^ *)" (?__abi_TestRuntimeC__toCS___IClass1PublicNonVirtuals____abi_LoadImage@?Q__IClass1PublicNonVirtuals@TestRuntimeC__toCS@@Class1@2@U$AAGJP$AAUIRandomAccessStream@Streams@Storage@Windows@@PAP$AAU?$IAsyncOperation@P$AAVBitmapImage@Imaging@Media@Xaml@UI@Windows@@@Foundation@7@@Z)	C:\Users\Stamatis\Documents\Visual Studio 2013\Projects\TestRuntimeC++toCS\TestRuntimeC++toCS\Class1.obj	TestRuntimeC++toCS
解决方案




这篇关于IAsyncOperation BitmapImage ^ C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:27