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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:23:44+00:00 2026-05-29T23:23:44+00:00

I have a noob question here. I’m getting my head around the C++ structure

  • 0

I have a noob question here.
I’m getting my head around the C++ structure and syntax and I’ve hit a bit of a wall.
I know I am missing something from my concept. So first a little code to help describe the situation.

Control.h

#pragma once
#ifndef CONTROL_H
#define CONTROL_H

class Control
{
    public:
        Control();
        ~Control();
    private:
    public:
};

#endif /*CONTROL_H*/

Control.cpp

#include "Control.h"
#include "Hello.h"

Hello helloObj;

Control::Control()
{
}

Control::~Control()
{
}

int main()
{
    int a = helloObj.HelloWorld();
    return 0;
}

Hello.h

#pragma once
#ifndef HELLO_H
#define HELLO_H

class Hello
{
    public:
        Hello();
        ~Hello();
    private:
    public:
         int HelloWorld(void);
};
#endif /*HELLO_H*/

Hello.cpp

#include "Hello.h"

Hello::Hello()
{
}

Hello::~Hello()
{
}

int HelloWorld()
{
    return 5;
}

I try and compile control.cpp with g++ on OSX 10.7 and get

Undefined symbols for architecture x86_64:
      "Hello::Hello()", referenced from:
              __static_initialization_and_destruction_0(int, int)in cccZHWtd.o
      "Hello::~Hello()", referenced from:
              ___tcf_1 in cccZHWtd.o
      "Hello::HelloWorld()", referenced from:
              _main in cccZHWtd.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Is it the compiler, my code or my concept of whats going on?
Am I not instantiating something correctly?

Any links describing this in more detail would be appreciated.

Ultimately I want to be able to run a function in another class and return the result…normal OO, keeping your program modular stuff….

  • 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-29T23:23:46+00:00Added an answer on May 29, 2026 at 11:23 pm

    The errors you are getting are Linking errors not compilation errors.
    The linker is not able to find definitions of the said functions & hence it reports the errors. It seems You have not included the Hello.cpp file containing the function definitions in your project.

    Make sure Hello.cpp is included in your project and is a part of your project or
    If you are using command line for compilation and linking make sure you have specified Hello.cpp in the file names on the command line.

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

Sidebar

Related Questions

I have a bit of a noob question about Windows Setup projects here. I've
A bit of a noob question here... I have a javascript function on a
PowerShell noob question here. I have groups of servers that are listed in separate
Hi Sorry for this noob question but here goes...i have a working slidetoggle on
Possible Duplicate: NSString stringWithFormat adding a percent a noob question here. I have a
a noob question here. I have an app that does number calculations. I support
a noob question here. I have the following code: - (IBAction)selectExistingPicture { if ([UIImagePickerController
a noob question here. I have a very strange situation that's very puzzling to
noob question here. I have a has_many :through relationship between items and tags. Finding
Noob Question here. I have created and successfully added an additional Page Layout to

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.