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

用户名

我正在尝试通过此代码从应用程序访问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

我的代码如下:

 #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();
  }
乔尔·朗多(Joel Rondeau)

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

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

&&:无法在类型'_Ty'上使用此间接寻址

错误不能在我的代码中使用 std Class 类型的对象作为数组

错误:实例成员不能在类型'ViewController'上使用

不能在 c++20 中使用 std::format

不能在 C Python 扩展中使用定义的类型

不能在分配中使用&dashUrl(* [] byte类型)作为* string类型

为什么我不能在C#中使用JsonConvert将Neo4jClient的查询结果(类型字符串)解析为Dictionary <string,string>

从std :: string获取类型,C ++

为什么不能在C ++中为std :: vector的字符串文字初始值设定项列表创建std :: vector <std :: string>?

实例成员不能在类型上使用

C ++使用std :: sscanf和std :: string

致命错误:不能在不同大小的类型之间使用unsafeBitCast(使用游戏包)

Golang 错误:不能在中位数的参数中使用 (type [5]int) 作为 int 类型

c ++不能在构造函数中使用父类型作为参数

在自定义类中初始化日期会导致错误:“实例成员不能在类型上使用”

C++:std::visit 不能在 gcc 下编译

从std :: map派生的类不能在Visual C ++上编译(但可以在gcc和clang上编译)

我不能在String.format上使用变量

不能对 std::set<std::string, std::less<>> 使用用户提供的比较函数

无法将变量传递到一个特定的类中,实例成员不能在类型错误时使用

Xcode 12.5 编译器错误,不能在需要类型“someType”的上下文中使用“nil”

Swift实例成员不能在类型上使用

实例成员不能在'ViewController'类型上使用

Swift:实例成员不能在类型上使用

实例成员“图层”不能在类型“ CustomPrettyView”上使用

C#/ F#互操作性:不能在F#代码中使用C#类型

使用std :: string时出现分段错误

由于类型不匹配而导致错误“ std :: string :: String`未实现特征” std :: ops :: FnMut <(char,)>`”

为什么会出现此错误?C ++中的std :: string数组“ [variable]不能命名类型”,即使它已包含在同一范围内