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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:48:31+00:00 2026-06-12T15:48:31+00:00

Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I

  • 0

Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?

I know this problem gets answered all the time, but I haven’t been able to find a solution for my specific example. Here’s the full error:

g++ main.cpp
Undefined symbols for architecture x86_64:
  "Board::display()", referenced from:
  _main in cc7hPZpy.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

I’m just trying to pull this display function from my Board class. Here’s main:

 #include "Board.h"
 #include <iostream>
 #include <string>

 using namespace std;

 int main()
 {
    cout << "Some Asian Game" << endl;
    Board base;
    base.display();
            //this is creating the error
            //commenting it out compiles, but obviously does not do what i want. 


    return 0;
 }

and Board.h:

#ifndef Board_H
#define Board_H

#include "Row.h"
#include <vector>
using namespace std;

class Board
{
public:
   vector<Row> rows;

   Board()
   {
        vector<Row> (15);
   }

   void play(int row, int col, char clr);
   bool checkWin(int row, int col, char clr);
   char getCellColor(int row, int col);
   void display();

   void empty();
};

#endif

and the particular function in question from board.cpp

void Board::display()
{
    for(int i=0;i<16;i++)
    {
         for(int i2=0;i2<16;i2++)
         {
           cout << rows[i].cells[i2].getState();
         }
    }
}

I’ve referred to this site often for answers, but have never used it personally, so bear with me on responding. I’m pretty positive this is something simple that I’m just overlooking though.

  • 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-12T15:48:33+00:00Added an answer on June 12, 2026 at 3:48 pm

    It should be

    g++ main.cpp board.cpp
    

    You’re not compiling board.cpp so the symbol is not exported.

    Also:

    Board()
    {
        vector<Row> (15);
    }
    

    is wrong. It just creates a temporary, you probably mean:

    Board() : rows(16)
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I
Possible Duplicate: Why do I get “unresolved external symbol” errors when using templates? “undefined
Possible Duplicate: Undefined Symbol ___gxx_personality_v0 on link I have a problem with the following
Possible Duplicate: Undefined reference - C++ linker error Now, I'm getting an Undefined reference
Possible Duplicate: sem_open() error: “undefined reference to sem_open()” on linux (Ubuntu 10.10) Having issues
Possible Duplicate: Why do I get “unresolved external symbol” errors when using templates? Why
Possible Duplicate: Undefined Reference to I've been banging my head against this one set

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.