main() as your friend ?
David C Binderman
dcb@pncl.co.uk
Sun Nov 15 09:39:00 GMT 1998
Hello there,
I'm a bit confused why the following C++ code doesn't link on RedHat Linux
5.1 on Alpha EV5.6 for snapshot 981109
# include <iostream.h>
struct S
{
public:
S();
friend int main();
private:
int a;
};
S::S()
{
a = 0;
};
S b;
int
main()
{
cout << b.a << '\n';
return 0;
}
I get
/usr/lib/crt1.o: In function `_start':
../sysdeps/alpha/elf/start.S:77: undefined reference to `main'
../sysdeps/alpha/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status
Regards
David C Binderman MSc BSc +44 1293 534847 dcb@pncl.co.uk
More information about the Gcc-bugs
mailing list