This document describes how to quickly integrate the Tencent Cloud IM SDK into your Windows project.
The following describes how to integrate the SDK into a Visual Studio 2019 project by creating a simple MFC project.
Download the IM SDK for Windows here as follows:
Download and decompress the IM SDK. You can rename it "ImSDK". It contains the following parts:
|include||API header file|
|lib\Win32||32-bit Release mode, which uses the /MT option to link library files.|
|lib\Win64||64-bit Release mode, which uses the /MT option to link library files.|
Open Visual Studio and create an MFC application named "IMDemo". If the MFC application is not one of the first options, you can search for it through the search template at the top.
For quick integration, select the relatively simple Dialog-based type on the Application Type page of the wizard. For other configuration items, keep them as default.
Copy the IM SDK folder generated after decompression (the "ImSDK" folder obtained in step 1) to the directory where
IMDemo.vcxproj is located.
The IM SDK provides 32-bit and 64-bit static libraries in Release mode, which require some special configurations. Open the IMDemo attribute page, select Solution Explorer, right-click
IMDemo, and select Properties.
The following takes the 32-bit Release mode as an example:
Add the include directory.
Go to C/C++ > General > Additional Include Directories and add the IM SDK header file directory
Add the library directory.
Go to Linker > General > Additional Library Directories and add the IM SDK library directory
Add the library file.
Go to Linker > Input > Additional Dependencies and add the IM SDK library file
Copy the DLL file to the execution directory.
Go to Build Events > Pre-Build Event > Command Line, enter
xcopy /E /Y "$(ProjectDir)ImSDK\lib\Win32" "$(OutDir)", and copy the
ImSDK.dll dynamic library file to the output directory of the project.
Specify the encoding format of the source file.
The IM SDK header file uses the UTF-8 encoding format, whereas some compilers compile source files in the default system encoding format. This may lead to compilation failure. Set this parameter to instruct compilers to compile source files using UTF-8 encoding.
Go to C/C++ > Command Line > Additional Options and enter
Most of the settings for the 64-bit Release are similar to those for the 32-bit Release. The difference lies in the IM SDK library directory as follows:
xcopy /E /Y "$(ProjectDir)ImSDK\lib\Win64" "$(OutDir)", and copy the
ImSDK.dlldynamic library file to the output directory of the project.
IMDemoDlg.cppfile, add the header file inclusion:
IMDemoDlg.cppfile, find the
CIMDemoDlg::OnInitDialogfunction and add the following test code before
SetWindowText(L"IMDemo"); std::string version = TIMGetSDKVersion(); CString szText; szText.Format(L"SDK version: %hs", version.c_str()); CWnd* pStatic = GetDlgItem(IDC_STATIC); pStatic->SetWindowTextW(szText);
fatal error C1083: unable to open the header file: "TIMCloud.h": No such file or directory
LINK : fatal error LNK1104: Unable to open the `ImSDK.lib` file.
error LNK2019: Unresolved external symbol `__imp__TIMGetSDKVersion`, referenced in the `"protected: virtual int __thiscall CIMDemoDlg::OnInitDialog(void)" (?OnInitDialog@CIMDemoDlg@@MAEHXZ)` function
Contact our sales team or business advisors to help your business.
Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.
Was this page helpful?