error LNK2019: unresolved external symbol

Hi everybody,
When I try to compile my S-function builder I get the following error:
Creating library myFunction.lib and object myFunction.exp myFunction_wrapper.obj : error LNK2019: unresolved external symbol ioctl referenced in function myFunction_Outputs_wrapper myFunction.mexw64 : fatal error LNK1120: 1 unresolved externals
This is the code that I use:
static char *i2cCtrlDevName = "/dev/i2ctrl"; static int i2cCtrlDev = -1; long ret;
i2cCtrlDev = open(i2cCtrlDevName, O_RDWR);
if (i2cCtrlDev < 0)
{
printf("Error opening '%s' device file\n", i2cCtrlDevName);
return -1;
}
ret = ioctl(i2cCtrlDev, I2CTRL_GET_INPUTS, 0);
if (ret < 0) return -1;
I realize that the problem is in ioctl function, which does not recognize. If anybody knows why this happens it will be very helpful.
Thanks in advance.

3 Kommentare

José-Luis
José-Luis am 5 Jun. 2014
That looks like a linking error. ioctl is part of a library and you are not telling your compiler where that library is.
Maialen
Maialen am 6 Jun. 2014
I still use this includes:
#include fcntl.h #include sys/ioctl.h #include sys/mman.h
Do I need some other file?
José-Luis
José-Luis am 6 Jun. 2014
I don't know. You could always look inside the library and see if the functions you need are listed there.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 5 Jun. 2014

Kommentiert:

am 6 Jun. 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by