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

  • Home
  • SEARCH
  • 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 7809507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:27:27+00:00 2026-06-02T03:27:27+00:00

I am trying to pass an array of Student into the function processStudent(string myFilename,

  • 0

I am trying to pass an array of Student

into the function processStudent(string myFilename, Student* myArray, int &mySize).
But it is giving me different kind of errors.

The Student() does nothing, but I tried to assign them some sort of value, it still give the exact same error message:

In the main I have this:

// Create an array of students, with the size of theMax (256)
Student* arrayOfStudent= new Student[theMax];

// An integer that will keep track of actually how many students
// Because when we loop, we want to loop within the cell
// that actually have data or student.
int actualSize = 0;

// Invoke the helper function to set up the array of students
// It passed the arryOfStudent by reference, so the changes
// inside of the function will be reflected when it returns
processStudent(filename, arrayOfStudent, actualSize);

The function is like this:

void processStudent(string myFilename, Student* myArray, int& mySize)
{
    // Something here, but removed still gives that error
}

// In the class Student’s cpp file

Student::Student() 
{
    // Nothing here
}

Error Message:

new-host-2:csci135p1 george$ g++ -Wall -o csci135p2main csci135p2main.cpp
Undefined symbols for architecture x86_64:
  "Student::Student()", referenced from:
      _main in cc3fTXti.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

I have been stripping and stripping down my code, but this error just won’t go away. I want to create this array, and pass it to the processStudent function, so it can set up each one when reading the file.

  • 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-02T03:27:29+00:00Added an answer on June 2, 2026 at 3:27 am

    You should ask yourself some questions that could help you:

    “How do I create new instance of Student?”
    Well, I do it like this: Student* s = new Student(); – it creates new object and stores the referrence to it as a pointer (Student*)

    “So how do I create an array of 10 Students?”
    Well, it’s probably going to be an array of pointers to new Students and I will probably have to call new more than once… by thinking this way you would easily end up with something like this:

    Student** students = new Student*[10];
    for (int i = 0; i < 10; ++i)
        students[i] = new Student();
    

    … which means, that when you clean it up, you will have to call delete on every Student* plus you’ll have to clean up the array itself: call delete[] on Student** – and when you realize the ugly memory management connect with array of pointers, it should make you look for simpler and better ways of implementing it, thus you should end up using std::vector instead of array, objects instead of pointers if it’s possible and if it’s not, then use smart pointers rather than naked pointers at least.

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

Sidebar

Related Questions

I'm trying to pass an array into a function and then use the information
im trying to pass an array as a string $(document).ready(function(){ var args = {};
I'm trying to pass a 2D array of char* into a function. I am
I'm trying to pass an entire array to the function but the last value
I am trying to pass an array (2d) to a function as an parameter.
1.I was trying to pass an array of string from 1 activity to another
I'm trying to pass a byte array from inside my rails app into another
I'm trying to pass an array to json.stringify but the returned value is coming
I'm trying to pass an array of ( varchar ) data into an Oracle
I'm trying to pass an array of string parameters to a C# ASP.NET web

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.