Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:21:08+00:00 2026-06-09T12:21:08+00:00

I recently added the file Serial.c and Serial.h to my Xcode project. The code

  • 0

I recently added the file Serial.c and Serial.h to my Xcode project.

The code for Serial.c is as follows,

#include <stdio.h>   /* Standard input/output definitions */
#include <stdlib.h>
#include <string.h>  /* String function definitions */
#include <unistd.h>  /* UNIX standard function definitions */
#include <fcntl.h>   /* File control definitions */
#include <errno.h>   /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

/*
* 'open_port()' - Open serial port on dock connector pins 13RX / 12TX
*
* Returns the file descriptor on success or -1 on error.
*/

int open_port(void)
{
int fd = -1; /* File descriptor for the port */

struct termios options; 

fd = open("/dev/tty.iap", O_RDWR | O_NOCTTY | O_NDELAY); // O_NOCTTY - don't be controlling terminal, O_NODELAY don't care about DCD signal state
if ( fd == -1)
{
    // couldn't open the port

    perror("open_port: Unable to open /dev/tty.iap - ");
}
else
    fcntl(fd, F_SETFL, 0);

tcgetattr(fd, &options); // get current options for the port

// set the baud rate
cfsetispeed(&options, B2400);
cfsetospeed(&options, B2400);

// enable the receiver and set local mode
options.c_cflag |= (CLOCAL | CREAD);

// set the new options for the port
tcsetattr(fd, TCSANOW, &options);

return (fd);

}

The serial.h file,

NSInteger openPort();

I am trying to get the output of the Serial RX data stream from the iPhone into a NSLog statement.

I call the OpenPort function in the ViewControllerSerialConsole.m file

- (void)viewDidLoad
{
 [super viewDidLoad];
// Do any additional setup after loading the view.


#if !TARGET_IPHONE_SIMULATOR    
NSInteger serial = openPort();
NSLog(@"The serial data is %d",serial);
//_serialView.text = serial;
#endif
}

The program compiles fine on the iPhone Simulator but doesn’t compile on an iPhone.

I get the following error messages,

Undefined symbols for architecture armv7:
“_openPort”, referenced from:
-[ViewControllerSerialConsole viewDidLoad] in ViewControllerSerialConsole.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: symbol(s) not found for architecture armv7

Any help on troubleshooting this problem would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:21:09+00:00Added an answer on June 9, 2026 at 12:21 pm

    Your app compiles fine for the simulator because you’re not referring to the missing “open_port” or “openPort” symbol**.

    In your Xcode project, select your “Serial.m” file in the list of files (along the left edge of the workspace) and look at the File Inspector for that file.

    Make sure the checkbox is ON for your project in the “Target Membership” setting.

    Make sure Target Membership is selected for your .m file

    ** while we are on the subject, is your function named correctly between your Serial.m & Serial.h file? I see “open_port” in one and “openPort” in the other.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I recently added a header file (and corresponding source file) to a project,
I've recently added this little bit of code to my .htaccess file: RewriteCond %{REQUEST_FILENAME}
I have an open source project hosted on Google Code and I recently added
Recently code.google.com added the feature to edit a file and syntax highlight it! From
I recently added these lines to my ~/.bashrc file to show the current branch
I recently added CKEditor to my app and I would like to include my
I recently added some namespaces to my web.config file so that all of my
I recently added the line (set-default-font -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1) to my .emacs file. After that find-file-other-window
I have some code here. I recently added this root_id parameter. The goal of
I only recently added a .gitignore file to ignore some specific data files in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.