Having issues fixing these issues: error LNK2019: unresolved external symbol "public: __thiscall grid::grid(void)" (??0grid@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'GridObject''(void)" (??__EGridObject@@YAXXZ) F:\Dev103\thermonuclear war game\thermonuclear war game\Grid.obj

error LNK1120: 1 unresolved externals F:\Dev103\thermonuclear war game\Debug\thermonuclear war game.exe 1

//header file
#include <iostream>
using namespace std;
class grid{

    int r, c;

    void GridFunction();
    int getR(){return r;}
    int getC(){return c;}
    void setR(int a){a = r;}
    void setC(int b){b = c;}

//create object
extern grid GridObject; //has something to do with this, when commented out fixes that error but rest of my program has issues. 

//cpp file

#include <iostream>
#include "Grid.h"
#include "Cities.h"

using namespace std;

grid GridObject;//has something to do with this

void grid::GridFunction(){

    //randomly generate grid size
    //set rows
    //set columns

    //display x co-ordinates
    for(int i=0;i <=GridObject.getC(); i++){

        cout << "  " << i << "  ";

    int counter = 0;
    for(int s=1;s< GridObject.getC()*GridObject.getR();s++){

        cout << "+--+";

        if(!(s % GridObject.getC())){

            cout << endl;

                for(int s=0;s<GridObject.getC();s++){

                    cout << "| << CityObject.getX() CityObject.getY()<< |";
        //generate x co-ordinates
        cout <<" "<<counter;
        cout << endl;


It has more to the program but the error is in this part. Any help will be highly appreciated.

unresolved external symbol "public: __thiscall grid::grid(void)"

This is saying that you have no implementation of the grid class' constructor.

commented: Thanks +0