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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:32:57+00:00 2026-05-30T05:32:57+00:00

//Class1 main int main() { … Class1 obj1(parameters); Class1 obj2(parameters); Class1 *Array[2]; Array[0] =

  • 0

//Class1 main

int main()
{
    ...

    Class1 obj1(parameters);
    Class1 obj2(parameters);    
    Class1 *Array[2];
    Array[0] = obj1;
    Array[1] = obj2;

    Class1 *Pointer = Array;

    Class2 repository(Pointer);   //where the error occurs.
}

obj1 and obj2 were created before and are class1 objects. class2 is a data repository class (Class2) I am trying to pass the array to it to point to it from Class2.

#include "Class2.h"
//what Class2 constructor looks like.

Class2::Class2(Class1* Pointer)
{
    tPointer = Pointer;
}

the problem is that I get an error saying
Undefined symbols:
"Class2::Class2(Class1*)", referenced from:
_main in Class1
ld: symbol(s) not found

Any help would be much appreciated thanks.

  • 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-30T05:32:58+00:00Added an answer on May 30, 2026 at 5:32 am

    You have quite a few errors, I’ll try to show you how to fix them.

    int main()
    {
        ...
    
       Class1 obj1(parameters);
       Class1 obj2(parameters);    
       Class1 *Array[2];
       Array[0] = &obj1; // Array holds pointers to Class1, so you need to use &
       Array[1] = &obj2; // Here too.
    
       Class1 *Pointer = Array[0]; // Use Array[0] or Array[1] here
    
       Class2 repository(Pointer);   //Should be okay now
    }
    

    Summary:

    In the line Array[0] = obj1; you are forgetting the address operator (same for next line).

    The line Class1 *Pointer = Array; doesn’t make sense because Array by itself is a pointer to a pointer, you want either Array[0] or Array[1] to make Pointer point at either obj1 or obj2.

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

Sidebar

Related Questions

Thanks for giving comments to the following. Class1 { debug(std::ostream&){} }; int main() {
Consider the following code: template<int* a> class base {}; int main() { base<(int*)0> test;
class Program { internal delegate int CallBack(int i); static void Main(string[] args) { CallBack
I subclassed UIScrollView Then created an object of it in the main class. Added
i wrote this program in VC++ 2010: class class1 { public: class1 (initializer_list<int> a){};
I have the following code : public class Main { private int i =
Consider the following test case: public class Main { static int a = 0;
#include <iostream> #include <vector> int main() { class Int { public: Int(int _i) :
i have a class main { Class1 class1=new Class1(); class1.function1(); } class Class1 {
I have the following classes. An error occurs during the for loop in the

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.