I am working on a homework assignment for my computer science class and, we are required to develop this simple program for our first use of C.
I was able to create the program through a straight gcc
compile, but while using gcc -lm -Wall -o
compile, my program crashes and returns
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What would cause my program to crash when entering it into the second compile?
My code
#include <stdio.h>
void main() {
float enrollment, fullsec, leftover, receiveA, receiveB, receiveC, receiveD;
printf("Program #1, masc0865, Tom Bachar");
printf("Enter enrollments on one line: ");
scanf("%f", &enrollment);
fullsec = enrollment/25;
leftover = enrollment%25;
printf("Enrollment = %f", enrollment);
printf("Amount of Full Sections = %f", fullsec);
printf("Students Left Over = %0.2f", leftover);
receiveA = enrollment*0.30;
receiveB = enrollment*0.25;
receiveC = enrollment*0.15;
receiveD = enrollment*0.30;
printf("Students expected to receive an A: %f", receiveA);
printf("Students expected to receive a B: %f", receiveB);
printf("Students expected to receive a C: %f", receiveC);
printf("Students expected to receive some other grade: %f", receiveD);
}