Cannot compile: Nested Structures

So my program won't compile and I think its because I used nested structures. It says that I need to check my library includes. Problem is, I don't know what to include :s So anyway, please help me! :D

There are three errors:

> [Linker error] PROJECT.o:PROJECT.c:(.text+0x47a): undefined reference to `place' 
   collect2: ld returned 1 exit status 
   [Error] [PROJECT.exe] Error 1 (if this is the only error: please check your library includes) 

Here's my code:

typedef struct{
    int thick, thin;
    int reds, bbqs, creams, pestos;
    float pepperoni, pork, mball, tuna, chicken, ham, bacon, shrimp;
    float mozz, cheddar, ricotta;
    float bellpep, redon, tom, olive, pine, mush;
}TOPP;

typedef struct{
    char name[128], address[128];
    double contact;
    int delivered;
}CUSDET;
typedef struct{
    int pres;
    int qtyordered;
    char name[128];
    char desc[128];
    float price10, price14, price18;
}PIZZA;
PIZZA prem[50]={0,0,'\0','\0',0,0,0};
typedef struct{
    float total, totalsum;
    TOPP myo10[10], myo14[10], myo18[10];
    CUSDET cus; 
}ORDZ;
ORDZ temp, *pt;
ORDZ order[90], *pol;
TOPP *pm;
CUSDET *pc;
PIZZA *ppm;`

then i used those in this function:

void cusdetails(){
pc=&temp.cus;
int a=0, a1;
do{
 system("cls");
    printf("RMR PIZZA - Customer Page.\n\n");
    printf("Welcome to RMR PIZZA!\n");
    printf("Enter Name: ");
    scanf(" %[^\n]s", &pc->name);
    printf("Enter Address: ");
    scanf(" %[^\n]s", &pc->address);
    printf("Enter Contact Number: ");
    scanf("%lf", &pc->contact);
    printf("\n\n Your details are as follows:\n\n");
    printf("Name: %s\n", pc->name);
    printf("Address: %s\n", pc->address);
    printf("Contact Number: %0.0lf\n", pc->contact);
}while(a==2);   
}

Upvotes: 1

Views: 133

Answers (2)

egur
egur

Reputation: 7960

The error is not related to your code.

The linker is saying that an identifier (function or variable) is declared and used but is missing from the object file.

This might happen if a global variable called place is declared as extern int place; and nowhere in the code is the actual instance int place;

For functions, this means that the function body wasn't compiled or it resides in a library that wasn't linked into the executable.

Upvotes: 1

David C. Rankin
David C. Rankin

Reputation: 84561

Your error has nothing to do with nested structures. The error:

Linker error] PROJECT.o:PROJECT.c:(.text+0x47a): undefined reference to `place' 
collect2: ld returned 1 exit status 

Is telling you it cannot find the command/function place used in some portion of your code that is not shown above. Most likely you have defined a function named place and it is used in your code before the definition appears (or it is a function from some other library (or file) that you have forgotten to include a header file for). Either way, you are attempting to use place and the linker is telling you it doesn't know what you are talking about. Show the code referring to place for more assistance.

Upvotes: 1

Related Questions