0

I am getting the error unresolved External symbol _applicationStartup referenced in function main. I have the function declared and defined correctly but it keeps giving the error. These are the main parts of the code, everything is stored and saved in the same file.

#include <stdio.h>
#include "accountTicketingUI.h"

#define ACCOUNT_SIZE 50
#define TICKET_SIZE 50

void populateAccounts(struct Account accounts[], int arrSize);
void populateTickets(struct Ticket tickets[], int arrSize);

int main(void)
{
 
    struct Account accounts[ACCOUNT_SIZE] = { {0} };
   
    struct Ticket tickets[TICKET_SIZE] = { {0} };

    struct AccountTicketingData data = { accounts, ACCOUNT_SIZE, tickets, TICKET_SIZE };

    populateAccounts(data.accounts, data.ACCOUNT_MAX_SIZE);

    populateTickets(data.tickets, data.TICKET_MAX_SIZE);

  
    applicationStartup(&data);

    return 0;
}

In accountTicketingUI.h I declare application startup first.

#include <stdio.h>
#include "account.h"
#include "ticket.h"





void applicationStartup(struct AccountTicketingData*);//starting function to call everything


void pauseExecution(void);//pause function
int displayAccountDetailHeader();//displays the header 
int displayAccountDeatailRecord(struct Account *);//function to display records

int menuLogin(const struct Account accounts[], int max);//login function
int menuAgent(struct AccountTicketingData*, const int ptr);//menu for the user

int displayAllAccountDetailRecords(const struct Account accounts[], int max);//displas everything an encrypts it

int findAccountIndexByAcctNum(int num, const struct Account accounts[], int max, int prompt);

struct AccountTicketingData
{
    struct Account* accounts;
    const int ACCOUNT_MAX_SIZE;
    struct Ticket* tickets;
    const int TICKET_MAX_SIZE;
};

And here is the actual code for application startup

void applicationStartup(struct AccountTicketingData *accounts[]) 
{
    int index;//loops and index holders

    while (1)
    {
        index = menuLogin(accounts, ACCOUNT_MAX_SIZE); 

        if (index != -1)
        {
            menuAgent(accounts, ACCOUNT_MAX_SIZE, index); 
        }
        else {
            break;
        }

    }
    printf("==============================================\n");
    printf("Account Ticketing System - Terminated\n");
    printf("==============================================\n\n");
}
FishLord
  • 1
  • 2
  • Where is applicationStartup defined? – kiner_shah Nov 23 '21 at 11:56
  • 1
    @kiner_shah it is defined in a file called accountTicketingUI.c – FishLord Nov 23 '21 at 12:01
  • 1
    The type `applicationStartup()` function parameter is different in its prototype (in header file) and in its definition. Remove `[]` from parameter in definition - `applicationStartup(struct AccountTicketingData *accounts[])`. – H.S. Nov 23 '21 at 12:18
  • 2
    The post says “everything is stored and saved in the same file” but shows the declarations are in “accountTicketingUI.h”, suggesting not everything is in one file. Clarify the statements. What is the name of the file that the source code for `main` is in? What is the name of the file that the source code for `applicationStartup` is in? How do you know whether the file that contains `applicationStartup` is being compiled and linked into your program? – Eric Postpischil Nov 23 '21 at 12:25

0 Answers0