错误 C3699: '^' : 无法在类型 'std::string' 上使用此间接寻址

use*_*477 5 c++-cli visual-c++

我试图从我的应用程序中访问 lync 代码,但出现错误。

error C3699: '^' : cannot use this indirection on type 'std::string'
error C2440: 'initializing' : cannot convert from 'System::String ^' to 'std::string *'
    1>        No user-defined-conversion operator available, or
    1>        Cannot convert a managed type to an unmanaged type
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

 #using <Microsoft.Lync.Model.dll>
 #using <Microsoft.Lync.Utilities.dll>

 //namespace provided that DLL
 using namespace Microsoft::Lync::Model;

  //Function which is using that DLL
   void getusername()
  {
   LyncClient ^lyncClient;
   string     ^text=lyncClient->Self->Contact->GetContactInformation(ContactInformationType::DisplayName)->ToString();
  }
Run Code Online (Sandbox Code Playgroud)

Joe*_*eau 3

ToString()正在返回托管System::String类型。这与非托管不同std::string

要从一种转换为另一种,请使用marshal_as