this is my program right now. I am getting an unresolved external error and unresolved external symbol_main referenced in function_tmainCRTStartup. What does this mean. It seems as if every time i even try to use C++ these are the errors that I get. Please help me.
#include <iostream>
using namespace std;
class Queue
{
private:
struct node
{
int data; //this is the part within the node that holds the data
node *item; //this is the 2nd part of the node that points to the data of the next node
}*Q;
public:
Queue(); //constructor
void Push( int X); //this will add items to the linkedlist
bool Array_Is_Empty(); //this is boolean because it either is or isn't empty (T or F)
bool Array_Is_Full(); //this is also boolean because it either is or isn't full
void Empty_Array(); //this will empty the stack
void Add_To_Beginning(int X); //this will add a node to the beginning of the linkedlist
void Add_To_End(int C, int X); //this will add a node to the end of the linkedlist
void Pop( int X );
void DisplayList();
int CountList();
~Queue(); //destructor
};
t = new node;
t->data = X;
t->item = NULL;
q->item = t;
}
}
void Queue::Pop( int X )
{
node *q,*r;
q = Q;
if( q->data == X )
{
Q = q->item;
delete q;
return;
}
r = q;
while( q!=NULL )
{
if( q->data == X )
{
r->item = q->item;
delete q;
return;
}
r = q;
q = q->item;
}
cout<<"\nData "<<X<<" was not found. Please try again later.";
}
void Queue::Add_To_Beginning(int X)
{
node *q;
q = new node;
q->data = X;
q->item = Q;
Q = q;
}
void Queue::Add_To_End( int C, int X)
{
node *q,*t;
int i;
for(i=0,q=Q;i<C;i++)
{
q = q->item;
if( q == NULL )
{
cout<<"\nThere are less than "<< C <<" elements.";
return;
}
}
t = new node;
t->data = X;
t->item = q->item;
q->item = q;
}
99% of the time, "unresolved external symbol" means the linker is looking for a function body and can't find it.
This is often due to you prototyping a function and calling it in your code, but never actually giving the function a body.
In your case, it's because you didn't give a int main() function. You need a main function so the computer knows where your program is supposed to start.