I was wondering if it is possible to define inside main()something like:
struct runtime_entry_point
{
friend int main()
{
}
};
I tested this and it does not work (almost in GCC 4.8.2):
g ++ -o dist / Release / GNU-Linux-x86 / turbo build / Release / GNU-Linux-x86 / main.o / usr / lib / gcc / x 86_64-unknown-linux-gnu / 4.8.2 /../ ../../../lib/crt1.o: In the function `_start ': collect2: error: ld exited with status 1
It sounds to me like defining a mistake main().
Later I wrote the main classic version:
struct runtime_entry_point
{
friend int main()
{
}
};
int main(){}
Now compilation failed because it is int main()already defined inside a struct runtime_entry_point! What is going on here?
source
share