error LNK2019: unresolved external symbol __imp_
3 views (last 30 days)
Show older comments
Hi, I am facing an issue while generating the mex file for a S function in MATLAB 2012b. But the mex file generation in Matlab 2012b 64 bit is showing the following error. And the .pdb file is not generated.
>> mex virtual_bus_sfun.c
Your MATLAB session has timed out. All license keys have been returned.
Creating library C:\Users\knilayan\AppData\Local\Temp\mex_VZ4CKa\templib.x and object C:\Users\knilayan\AppData\Local\Temp\mex_VZ4CKa\templib.exp
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_signal referenced in function mdlOutputs
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_update referenced in function mdlOutputs
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_reset referenced in function mdlOutputs
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_wait referenced in function mdlOutputs
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_delete referenced in function mdlStart
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_connect referenced in function mdlStart
virtual_bus_sfun.obj : error LNK2019: unresolved external symbol __imp_virtual_bus_disconnect referenced in function mdlTerminate
virtual_bus_sfun.mexw64 : fatal error LNK1120: 7 unresolved externals
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Link of 'virtual_bus_sfun.mexw64' failed.
The mentioned “external symbols” in error message are declared in the header file “Virtual_Bus.h”. Both the header files “Virtual_Bus.h” is present in the MATLAB path. It would be really great if someone could help me out with this linker error.
Virtual_Bus.h:
#ifndef VIRTUAL_BUS_H
#define VIRTUAL_BUS_H
/* DLL boilerplate code */
#ifdef VIRTUAL_BUS_EXPORTS
#define VIRTUAL_BUS_API __declspec(dllexport)
#else
#define VIRTUAL_BUS_API __declspec(dllimport)
#endif
#include "Virtual_Bus_Types.h"
#ifdef __cplusplus
extern "C"
{
#endif
VIRTUAL_BUS_API struct Virtual_Bus_Data* virtual_bus_connect(
char* const bus_name);
/** @brief Disconnect from a virtual bus
*
* Disconnects from a virtual bus identified by the specified pointer.
*
* @param bus_data = Virtual_Bus_Data* structure
* @return Virtual_Bus_Error_Code error code type
*/
1 Comment
Sebastian Schulte
on 8 May 2017
Hi,
I guess it's a x64/x32 issue. You build templib.x with a 32 bit compiler, right?
Best greetings Sebastian
Answers (0)
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!