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

  • Home
  • SEARCH
  • 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 888487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:24:22+00:00 2026-05-15T13:24:22+00:00

I am working on a C++ assignment for class that wants me to overload

  • 0

I am working on a C++ assignment for class that wants me to overload the “>>” operator. I am encountering errors linking in both Visual Studio 2005 and Xcode 3.2.2. The C++ code is separated into a few files. The prototypes are stored in overload.h, the implementations are stored in overload.cpp, and main() is in overloadtester.cpp (although I have not been able to put anything related to this new overloaded operator in main yet because of the error. below is the code I added before I started getting the errors (listed below)

// overload.h  
// Class Name OverloadClass
#ifndef _OverloadClass_H
#define _OverloadClass_H
#include < string >  
using namespace std ;
class OverloadClass
{
public:
    // Constructors and methods
private:
    x_;
    y_;
};
istream& operator>> (istream& in, OverloadClass &p);
#endif



// overload.cpp
#include < iostream >
#include < string >
#include < sstream >
#include < istream >  
extern "C"
{
#include "DUPoint.h"
}  
using namespace std ;  

void OverloadClass::input()
{
    char leftParen;
    char comma ;
    cin >> leftParen >> x_ >> comma;

    char rightParen;
    cin >> y_ >> rightParen;
}



// Constructor and method implementations  
istream& operator>> (istream& in, OverloadClass &p)
{ 
    p.input();
    return in;
}

The error I have been getting in Xcode is:

Link ./OverloadDirectory   
Undefined symbols: "operator>>(std:basic_istream >&, OverloadClass&)" referenced from: _main in overloadtester.o 
ld: symbol(s) not found collect2: ld returned 1 exit status

I dont have access to the computer with VS at this very moment hopefully when I do I can post the error I am getting from running the code on that IDE.

Edited in response to @Mark’s request for more details
Edited in response to @sbi’s request for more info on input()

  • 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-05-15T13:24:23+00:00Added an answer on May 15, 2026 at 1:24 pm

    The error undefined symbol is a linker error. It means that when you are linking all your code into a single executable / library, the linker is not able to find the definition of the function. The main two reasons for that are forgetting to include the compiled object in the library/executable or an error while defining the function (say that you declare void f( int & ); but you implement void f( const int & ) {}).

    I don’t know your IDEs (I have never really understood Xcode) but you can try to compile from the command line: g++ -o exe input1.cpp input2.cpp input3.cpp ...

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

Sidebar

Related Questions

I'm working on an assignment in my beginner Javascript class that involves an element
I want to overload the assignment operator for types like int, long etc. That
I'm working on a class assignment that started small, so I had it all
I am working on a homework assignment for my into to programming class that
I'm currently working on an assignment that has me creating a Map class in
This is an assignment i am working on for class. To make a long
We are working on a lab assignment for my CS&E class and I think
I am working on a project for my advanced Java class, and the assignment
For a homework assignment, I'm working with the following. It's an assigned class structure,
I'm working on my assignment of PHP course. The problem that I don't understand

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.