I need to modify the shipped xPC udp block to fit my needs. So, I created a C++ S-function block that closely resembles the shipped UDP block in xPC Target 4.1 (R2009a). I am using xpce* functions declared in 'xpcimports.h' in my S-function code. For compiling I am using the following command with MSVC++ 2008 (Version 9.0) compiler:
mex -L"<MSVC INSTALLATION FOLDER>\Microsoft Visual Studio 8\VC\PlatformSDK\Lib" -lWS2_32 MTX_UDP_Send_v2.cpp
The code successfully compiles and I could simulate the model.
However, when building the model for xPC Target, I am getting the following Linker error:
MTX_UDP_Send_v2.obj : error LNK2019: unresolved external symbol "int (__cdecl* xpceUDPOpenSend)(char const *,int,int,int,int)" (?xpceUDPOpenSend@@3P6AHPBDHHHH@ZA) referenced in function "void __cdecl mdlStart(struct SimStruct_tag *)" (?mdlStart@@YAXPAUSimStruct_tag@@@Z) MTX_UDP_Send_v2.obj : error LNK2019: unresolved external symbol "unsigned char (__cdecl* xpcIsModelInit)(void)" (?xpcIsModelInit@@3P6AEXZA) referenced in function "void __cdecl mdlStart(struct SimStruct_tag *)" (?mdlStart@@YAXPAUSimStruct_tag@@@Z) MTX_UDP_Send_v2.obj : error LNK2019: unresolved external symbol "int (__cdecl* xpceUDPSend)(int,unsigned char *,int)" (?xpceUDPSend@@3P6AHHPAEH@ZA) referenced in function "void __cdecl mdlOutputs(struct SimStruct_tag *,int)" (?mdlOutputs@@YAXPAUSimStruct_tag@@H@Z) MTX_UDP_Send_v2.obj : error LNK2019: unresolved external symbol "void (__cdecl* xpceUDPClose)(int)" (?xpceUDPClose@@3P6AXH@ZA) referenced in function "void __cdecl mdlTerminate(struct SimStruct_tag *)" (?mdlTerminate@@YAXPAUSimStruct_tag@@@Z)
Is there an issue with my code?
Best Answer