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 8012189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:15:11+00:00 2026-06-04T19:15:11+00:00

I have created a new class of type NSObject, which created two files —

  • 0

I have created a new class of type NSObject, which created two files — a .h and a .m file. Here is the code from the two files:

SocketConnection.h

#import <Foundation/Foundation.h>

@interface SocketConnection : NSObject
{

}

+ (SocketConnection *)getInstance;

@end

SocketConnection.m

#import "SocketConnection.h"
#import "imports.h"

static SocketConnection *sharedInstance = nil;

@implementation SocketConnection

- (id)init
{
    self = [super init];

    if (self) 
    {
        while(1)
        {
            Socket *socket;
            int port = 11005;
            NSString *host = @"199.5.83.63";

            socket = [Socket socket];

            @try
            {
                NSMutableData *data;
                [socket connectToHostName:host port:port];
                [socket readData:data];
                //  [socket writeString:@"Hello World!"];

                // Connection was successful //
                [socket retain]; // Must retain if want to use out of this action block.
            }
            @catch (NSException* exception) 
            {
                NSString *errMsg = [NSString stringWithFormat:@"%@",[exception reason]];
                NSLog(errMsg);
                socket = nil;
            }
        }
    }
    return self;
}

+ (SocketConnection *)getInstance
{
    @synchronized(self) 
    {
        if (sharedInstance == nil) 
        {
            sharedInstance = [[SocketConnection alloc] init];
        }
    }
    return sharedInstance;
}

@end 

And I seem to be getting a Linker error. When I comment out all the code in the SocketConnection.h/SocketConnection.m, the errors go away. I have several views in my project. I have a header file called “imports.h”, which I have imported SocketConnection.h, and included “imports.h” in my SocketConnection.m file. Any help would be greatly appreciated, since I seem to be stuck here :/. Thanks!

Errors:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Socket", referenced from:
objc-class-ref in SocketConnection.o
(maybe you meant: _OBJC_CLASS_$_SocketConnection)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • 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-04T19:15:12+00:00Added an answer on June 4, 2026 at 7:15 pm

    You need to #import “Socket.h” at the top of you .m file.

    The error here

        "_OBJC_CLASS_$_Socket", referenced from:
    objc-class-ref in SocketConnection.o
    

    is saying that SocketConnection is referencing an Objective-C class named “Socket” that it does not know about.

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

Sidebar

Related Questions

I have generated a strongly-type view from a model class that I have created
I have created a gem that adds a new method to the class ActiveRecord::Base.
I am new to iphone development.I have created a UIview controller class and added
I have created a class of type BaseAdapter that is populated with buttons -
I have created an abstract class FbActivity, which extends Activity to connect to facebook
I have created a custom even class which is pretty basic. But when calling
I have a class file to handle the GUI which is SampleGUI.class. I want
I have created window derived class (WindowAttachedCollection.MyWindow) and attached property which holds collection of
I've created a new class called Actor which processes messages passed to it. The
I have created a class for a dashboard item which will hold information such

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.