I am trying to install a program using port on FreeBSD 4.7. I get this error:
Couldn't find your current GCCVERSION (OSVERSION=470000)
How would you fix an error like this?
I don't think 4.7 is supported by the current ports tree. You might be able to edit /usr/ports/Mk/bsd.gcc.mk to have a value for GCCVERSION. But considering 4.x had gcc 2.95 its likely that you will have trouble compiling unless you first upgrade gcc.
Another options is to forget ports and just compile the program by hand. You can use the port Makefile as a guide.
FreeBSD 4.7 was released in 2002 and the 4.x branch last had a release in 2005. In 2007 it reached "End of Life" status. You really should upgrade.