MFC 连接SAP 类和函数找不到RFC SDK

程序中:


RFC_TABLE_DESC table_desc;


// 设置RFC连接参数
   rta_set_connection_param(connection, "ashost", "SAP_SERVER");
    rta_set_connection_param(connection, "sysnr", "00");
    rta_set_connection_param(connection, "client", "100");

H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(204) : error C2065: 'RFC_TABLE_DESC' : undeclared identifier
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(204) : error C2146: syntax error : missing ';' before identifier 'table_desc'
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(204) : error C2065: 'table_desc' : undeclared identifier
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(212) : error C2065: 'rta_init' : undeclared identifier
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(219) : error C2065: 'rta_create_native_connection' : undeclared identifier
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(219) : error C2440: '=' : cannot convert from 'int' to 'struct _RFC_CONNECTION_HANDLE *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\VC程序\SAP连接\ConnectSAP\ConnectSAPDlg.cpp(222) : error C2065: 'rta_set_connection_param' : undeclared identifier

该回答引用GPT:
看起来你的代码中没有包含RFC SDK的头文件,因此编译器无法识别RFC_TABLE_DESC、rta_init、rta_create_native_connection和rta_set_connection_param这些函数和类型。

请在代码中添加以下头文件:

#include <saprfc.h>
#include <saprfc_ex.h>

如还有疑问,可留言帮助解决。

有没有大神有MFC连接SAP相关DEMO