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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:22:43+00:00 2026-05-26T22:22:43+00:00

I have a very small program in Xcode only displaying a label and changing

  • 0

I have a very small program in Xcode only displaying a label and changing the text of the label in the viewWillAppear method. The label.text should come from a C++ library with a function like this:

int getNumber(){
    return 42;
}

The problem is, that including the class with #import “TestLibMain.h” in my *.mm(!) class and using the function with

TestLibMain *tlb = new TestLibMain();
int myInt = tlb->getNumber();
NSString *myString = [NSString stringWithFormat:@"%d",myInt];

doesn’t invoke a compiler error, but a linker error:

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

My impression is, that the cpp-class has not been compiled.

I tried a lot of things around, but somewhere it’s hanging. It’s all in the same directory, I use the .mm extension, everything fine, but always this linker error. Getting crazy 🙂

Mac OS X Lion, XCode 4.2

Any ideas?

  • 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-26T22:22:44+00:00Added an answer on May 26, 2026 at 10:22 pm
    int getNumber() {
        return 42;
    }
    

    in a .cpp or .mm defines getNumber() as a free function. This:

    int TestLibMain::getNumber() {
        return 42;
    }
    

    defines getNumber() as a member of TestLibMain.

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

Sidebar

Related Questions

have small problem, and would very much appreciate help :) I should convert byte
I'm very new to PHP and I have a small task of displaying a
I have written a small program displaying sounds and images on the screen when
I have a program where I deal with a lot of very small numbers
I have a very small c++ program that consists of two files: main.cpp and
I have written a very small C# program, that uses a very small SQL
i have a very small utilty app written in c# that works fine on
I have a very small form where a user can enter their zip code
I have a requirement to change a very small part of the WPF ComboBox's
I have a small (500kb) swing applet that displays very simple/limited set of small

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.