#include "my_allocator.h"
int main()
{
unsignedint memory_size = 0;
unsignedint block_size = 0;
printf("Enter the memory size and basic block size (in bytes). Both values must be a power of two.\n");
printf("Memory size: ");
scanf("%d", &memory_size);
while (!PowerOfTwo(memory_size)) // Non-power of two
{
printf("\nInvalid number. Please enter a power of two.\n");
printf("Memory size: ");
scanf("%d", &memory_size);
}
printf("\nBasic block size: ");
scanf("%d", &block_size);
while (!PowerOfTwo(block_size)) // Non-power of two
{
printf("\nInvalid number. Please enter a power of two.\n");
printf("Basic block size: ");
scanf("%d", &block_size);
}
printf("\n");
init_allocator(block_size, memory_size);
release_allocator();return 0;
}
I get this undefined reference error:
/tmp/cc0EFhYP.o(.text+0x186): In function `main':
: undefined reference to `init_allocator(unsigned, unsigned)'
/tmp/cc0EFhYP.o(.text+0x18e): In function `main':
: undefined reference to `release_allocator()'
collect2: ld returned 1 exit status
Even though those functions are declared in "my_allocator.h" (included), and defined in my_allocator.c (also includes my_allocator.h). And I checked: There are no mispellings, and the parameters are valid.