0

I am getting an error building my c++ program on xcode. For each of the various fuctions of the IOKit I am getting "use of undeclared identifier". I really don't know why I am getting this error. Here is the code:

#include <iostream>
#include <xlnt/xlnt.hpp>
#include <xlnt/xlnt_config.hpp>
#include <IOKitLib.h>
#include <IOTypes.h>
#include <IOReturn.h>
#include <IOKitKeys.h>
#include <iokitmig.h>
#include <OSMessageNotification.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <paths.h>
#include <termios.h>
#include <sysexits.h>
#include <sys/param.h>
#include <sys/select.h>
#include <sys/time.h>
#include <time.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/serial/IOSerialKeys.h>
#include <IOKit/IOBSD.h>

#define LOCAL_ECHO
#ifdef LOCAL_ECHO
#define kOKResponseString “AT\r\r\nOK\r\n”
#else
#define kOKResponseString “\r\nOK\r\n”
#endif


#define kATCommandString        "AT\r"
#define kMyErrReturn            -1
enum {
kNumRetries = 3
};

static struct termios gOriginalTTYAttrs;



int main()
{
char path;
char text;

int fileDescriptor;
kern_return_t kernResult;
io_iterator_t serialPortIterator;
char deviceFilePath[MAXPATHLEN];
kernResult = MyFindModems(&serialPortIterator);
kernResult = MyGetModemPath(serialPortIterator, deviceFilePath,
                            sizeof(deviceFilePath));

Here is the image with all the errors shown: https://i.sstatic.net/e1UZS.jpg Any advice would be more than appreciated. Is it because I haven't declared the functions? Thanks in advance Alex

11
  • You certainly need to declare functions before you use them. For more specific help, please quote the exact error message. Commented Mar 26, 2020 at 22:18
  • please show the exact error message you are getting Commented Mar 26, 2020 at 22:19
  • Thanks for the answer, I have just edited the thread by adding an image with all the errors that I am getting Commented Mar 27, 2020 at 7:59
  • Are you including the code that implements MyFindModems etc? according to your screenshot of errors (text, next time...) this has nothing to do with IOKit. Commented Mar 27, 2020 at 8:52
  • if I declare the function like this: kern_return_t MyFindModems(&serialPortIterator); i get the following error("Cannot initialize a variable of type 'kern_return_t' (aka 'int') with an rvalue of type 'io_iterator_t *' (aka 'unsigned int *')" Commented Mar 27, 2020 at 8:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.