hy guyz...

since i'm new to this forum i just want to say hello to you all...

anyway, back to business. my teacher in my CS class gave me and my group an activity to work on. and since i'm the leader of the group, i was tasked to evaluate and compile the program. when i compiled and ran the program this pops out:

'Error: Unresolved external '_Initialize' referenced from F:\CS121\MEMBER1.OBJ'

and

'Error: Unresolved external '_Menu' referenced from F:\CS121\MEMBER1.OBJ'

[by the way.. i'm using borland C++ v4.5]

so can anybody shed some light on this matter and how do i fix this...?

thanks a bunch...

peace out!

Recommended Answers

All 9 Replies

no...

not exactly...

she gave us a problem to work on and while i was trying to make an .exe, the errors just came out of nowhere...

Having written

int main ( ) {
  Menu();
  return 0;
}

You then need to also write

void Menu ( void ) {
  // do something.
}

You can't just magic functionality into existence just by mentioning it's name - that is what the linker is telling you!

this is what is inside declare.h:

#define N 10
typedef char FName[24];
typedef int POSITION;
typedef struct
{
	FName *FNamePtr;
	int last;
}celltype, *LIST;

void Initialize (LIST *A);
void Menu(void);
POSITION GetChoice(void);
void MakeNull(LIST *A);
void Insert(LIST *A, FName *X, POSITION pos);
void GetELem(char *X);
POSITION GetPosition(void);
void Delete(LIST *A, POSITION pos);
POSITION Locate(LIST A, FName *X);
FName* Retrieve(LIST A, POSITION pos);
void PrintList(LIST A);

this is what is inside main:

void main()
{
	LIST L;
	int i, k = 1;
	POSITION p;
	char X[24];

	Initialize(&L);
	Menu();
	while(k)
   {
		i = GetChoice();
			switch(i)
			{
				case 1: MakeNull(&L);
                    break;
				case 2: GetElem(X);
                    p = GetPosition();
					     Insert(&L, X, p);
                    break;
				case 3: GetElem(X);
					     p = GetPosition();
					     Delete(&L, p);
					     break;
				case 4: GetElem(X);
					     Locate(L, X);
					     break;
				case 5: p = GetPosition();
					     Retrieve(L, p);
					     break;
				case 6: PrintList(L);
					     break;
				case 7: printf("Program will now terminate.");
                    k = 0;
					     break;
			}
   }
}

this is what is inside member2:

void GetElem(char *X)
{
   FName temp[24];
	printf("Please Input Name:");
	gets((*temp));
   strcpy(X, (*temp));
}

int GetPosition(void)
{
	POSITION p;
	printf("Please Input Desired Position:");
	scanf("%d", &p);
	return p;
}

void Insert(LIST *A, FName *X, POSITION pos)
{
	POSITION i;
	if(((*A)->last < N-1)&&(pos <= (*A)->last))
   {
   	if(pos <= (*A)->last+1)
      {
      	for(i = (*A)->last; i >= pos; i--)
         {
         	strcpy((*A)->FNamePtr[i+1], (*A)->FNamePtr[i]);
         }
         strcpy((*A)->FNamePtr[pos], *X);
      }
   }
}

void Delete(LIST *A, POSITION pos)
{
	POSITION i;
	if((pos <= (*A)->last)&&(pos != -1))
   {
		for(i = (*A)->last; i >= 0; i--)
      {
			if(i == pos)
         {
				strcpy((*A)->FNamePtr[i], NULL);
         }
      }
   }
	(*A)->last--;
}

this is what is inside member3:

void menu()
{
		printf("\tchoose a task : \n");
		printf("\t1] MakeNull \n");
		printf("\t2] Insert \n");
		printf("\t3] Delete \n");
		printf("\t4] Locate \n");
		printf("\t5] Retrieve");
		printf("\t6] Print List");
		printf("\t7] Exit \n");
}

int GetChoice(void)
{
	int x;
	printf("\nEnter Choice : ");
   scanf("%d",&x);
	 return x;
}

void PrintList(LIST A)
{
   int i;
	printf("\n The name : ");
   	for(i = 0; i < A->last; i++)
      {
			puts(A->FNamePtr[i]);
      }
}

this is what is inside member4:

void Intialize(LIST *A)
{
	(*A)=(LIST)malloc(sizeof(celltype));
   (*A)->FNamePtr=(FName*)malloc(sizeof(FName));
   (*A)->last=-1;
}

void MakeNull(LIST *A)
{
	free((*A)->FNamePtr);
 	free(*A);
 	(*A)=NULL;
}

POSITION Locate(LIST A, FName *X)
{
 POSITION i, var;
 	for(i=0;i <= A->last; i++)
 	{
 		if((i <= A->last)&&(strcmp(A->FNamePtr[i], *X)!= 0))
   	{
   		var = i;
   	}
 	}
 return var;
}

FName* Retrieve(LIST A, POSITION pos)
{
 FName *ptr;
 if(pos <= A->last)
 {
 	ptr = A->FNamePtr[pos];
 }
 return ptr;
}

and still the errors persisted...

I know that there are some errors in the code but I can't seem to find them...that's my problem...

NO! .. that's not your problem ... your problem is you're not taking the time to isolate the problem and present it in such a way that people on this forum would be even remotely motivated to even think of helping you!

Cheers.

In case you're still wondering, edit your post so that it has code tags, then people might just take an interest.

Read some other posts, notice how code is nicely formatted.
Make yours as good.

Your coding standard is really horrible.anyways two problems found...
the fucntions names in prototype and defination were not matching.

1)change menu to Menu
2)change Intialize to Initialize

in the function definations

void Menu() //CC-1  menu changed to Menu
{
		printf("\tchoose a task : \n");
		printf("\t1] MakeNull \n");
		printf("\t2] Insert \n");
		printf("\t3] Delete \n");
		printf("\t4] Locate \n");
		printf("\t5] Retrieve");
		printf("\t6] Print List");
		printf("\t7] Exit \n");
}



void Initialize(LIST *A) ///Intialize is changed to Initialize
{
	(*A)=(LIST)malloc(sizeof(celltype));
   (*A)->FNamePtr=(FName*)malloc(sizeof(FName));
   (*A)->last=-1;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.