For what i know it might have worked, but the correct way to deal with it is with an extern.
When you do
Code: Select all
void function();
int main()
{
funtion();
return 0;
}
You are telling the compiler that function() will be defined later in the same translation unit (the way C calls a file, so to say). What, obviously is not the case.
This might have worked with ld (what gcc calls to link everything), but is not guaranteed to work in other compilers.
You should do
Code: Select all
extern void function();
int main()
{
funtion();
return 0;
}
To say that function() is in a
extern translation unit (file). And then everything should be ok
Cheers,
KM