Hey all,
So I am busy reading "Learn C on Mac" - I'm on chapter six at the moment.
Busy learning about the switch statement and I understand exactly how it works. So I wanted to make a small program - which uses the number of eggs to decide what statement it should execute.
I also decided instead of a simple printed () statement, I would ask the compiler to call a function instead.
So here is the code:
Now I am aware that I have three functions that have no definitions - I was first testing the "French toast" function.
I have rewritten the code for all functions to have definitions and xCode gives me the following for errors:
Now I am not 100% sure what this is telling - but it seems like it is not referencing the functions?
Any help to understand this code would be great!
Thanks guys.
So I am busy reading "Learn C on Mac" - I'm on chapter six at the moment.
Busy learning about the switch statement and I understand exactly how it works. So I wanted to make a small program - which uses the number of eggs to decide what statement it should execute.
I also decided instead of a simple printed () statement, I would ask the compiler to call a function instead.
So here is the code:
Code:
#include <stdio.h>
void HardBoilThem (void);
void MakeAnOmlet (void);
void FrenchToastForEveryOne (void);
int main (int argc, char const * argv[])
{
int numberOfEggs;
numberOfEggs = 12;
switch ( numberOfEggs ) {
case 1:
case 2:
HardBoilThem();
break;
case 3:
MakeAnOmlet ();
break;
default:
FrenchToastForEveryOne();
return 0;
}
void FrenchToastForEveryOne ( void );
{
printf ( "French Toast!\n" );
}
Now I am aware that I have three functions that have no definitions - I was first testing the "French toast" function.
I have rewritten the code for all functions to have definitions and xCode gives me the following for errors:
Undefined symbols for architecture x86_64:
"_HardBoilThem", referenced from:
_main in main.o
"_MakeAnOmlet", referenced from:
_main in main.o
"_FrenchToastForEveryOne", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Now I am not 100% sure what this is telling - but it seems like it is not referencing the functions?
Any help to understand this code would be great!
Thanks guys.