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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:27:58+00:00 2026-06-14T00:27:58+00:00

I am using Xcode and it refuses to compile when passing reference to the

  • 0

I am using Xcode and it refuses to compile when passing reference to the string object itself.

(string &text, string remove)

without & it compiles. Is it my code that is wrong or could it be something with the project file?

this is the compiler error:

Undefined symbols for architecture i386:
"removeLetters3(std::string, std::string)", referenced from:
  Main() in narcissism.o
 ld: symbol(s) not found for architecture i386
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Code:

string removeLetters3(string &text, string remove)
{
for (int i = 0; i < remove.length(); i++)
{
    int pos = 0;

    while ((pos = text.find(remove[i], pos)) != string :: npos)
    {
        text.replace(pos, 1, "");
    }
}
return "";
}

and here is how the function is called:

string text;
string rletter;
removeLetters3(text, rletter);
  • 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-14T00:27:59+00:00Added an answer on June 14, 2026 at 12:27 am

    There is nothing wrong with your code but judging from your error I would assume that the declaration that the caller sees is this:

    string removeLetters3(string text, string remove);
    

    While your implementation reads

    string removeLetters3(string &text, string remove) {
    

    So when your linker tries to find the implementation of the first one it fails because there is no such implementation.

    This is evidenced by the error:

    Undefined symbols for architecture i386:
    "removeLetters3(std::string, std::string)", referenced from:
      Main() in narcissism.o
    

    notice the signature. It is not saying:

    Undefined symbols for architecture i386:
    "removeLetters3(std::string&, std::string)", referenced from:
      Main() in narcissism.o
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using Xcode and c++ I have copied the HoughCircles code from the OpenCV
I am using XCODE 4.2 & when I build my project I do not
Using XCode 4.2, I am using the static analyser on code similar to the
I am currently using xcode for some c++ development & I need to generate
Using XCode 4.4.1 I have the following OpenGL code: //set the tex params glTexParameteri(GL_TEXTURE_2D,
When using Xcode, does anyone else experience text lagging to be seen when typing.
Using Xcode 4.2 and ARC, I wrote the following code before I had any
Using Xcode 4.0 sometimes when I remove resources from the project they still appear
Using Xcode. In this code (func is declared in interface), tells subj error, standing
Using Xcode 4.2, how can one enable/disable Automatic Reference Counting? ANSWERED Under Build Settings,

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.