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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:18:56+00:00 2026-05-11T19:18:56+00:00

I have a lot of shared C++ code that I’d like to use in

  • 0

I have a lot of shared C++ code that I’d like to use in my iPhone app. I added the .cpp and .h files to my Xcode project and used the classes in my Objective-C++ code. The project compiles fine with 0 errors or warnings.

However, when I run it in the simulator I get the following error when I attempt to access an STL method in my objective-c code (such as .c_str()):

Program received signal:  “EXC_BAD_ACCESS”.

Unable to disassemble std::string::c_str.

Here’s an example of the code that causes the error:

[name setText:[[NSString alloc] initWithCString:myCPlusPlusObject->cppname.c_str()]];

where name is an NSTextField object and cppname is a std::string member of myCPlusPlusObject.

Am I going about this the right way? Is there a better way to use STL-laden C++ classes in Objective-C++? I would like to keep the common C++ files untouched if possible, to avoid having to maintain the code in two places.

Thanks in advance!

  • 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-11T19:18:56+00:00Added an answer on May 11, 2026 at 7:18 pm

    Make sure the string isn’t empty before passing it to the initWithCString function.

    Also the function you’re using has been deprecated, use this one instead.

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

Sidebar

Related Questions

I have a current existing project repository that has a lot of code that
I have code that's somewhat like this: ($i=0; $i < 100; $i++) { do
I find myself writing a lot of code in my views that looks like
I have seen a lot of shared hashmap implementations. Here is the specific scenario
we have a lot of users running in different shared and solo-owned repositories in
I have two unit tests that should share a lot of common tests with
I have a requirement to use date picker in my applicaiton. I have lot
We have a lot of VBA code in spreadsheets and a lot of time
I have a project where I am required to fix this program that has
I'm cleaning up some code, and I have a class with an entity that

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.