2
我試圖在此代碼中訪問我的應用程序中的lync我收到錯誤消息。錯誤C3699:'^':無法在類型'std :: string'上使用此間接尋址方式
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();
}
某處你有'使用命名空間標準;'立即停止,不要再做一次。你將'text'聲明爲'std :: string'而不是'System :: String'。這解決了這兩個錯誤。 – crashmstr
此外,請確保您標記C++ - CLI,因爲這是正確的「語言」標記 – crashmstr