#pragma strict gives error with camera.copyFrom

Started getting EXC_BAD_ACCESS when compiling for iPhone.

Found advice on forums to add a #pragma strict directive to my scripts (“One good thing is to add #pragma strict at the beginning of every script, so you will get warnings if you have some code that can’t run on iOS”).

Without the directive, this script snippet gives me no error.
With it, I get: ‘camera’ is not a member of ‘Object’.

#pragma strict 
private var copyCam;

function Awake () {
	copyCam = new GameObject ("camera2", Camera);
	copyCam.camera.CopyFrom(Camera.main);
}

Tried everything I could think of (GetComponent etc). Nothing works. Searched forums for answers but found none.

Define the copyCam type, like this:

#pragma strict 
// copyCam is a GameObject
private var copyCam : GameObject;

function Awake () 
{
    copyCam = new GameObject ("camera2", Camera);
    copyCam.camera.CopyFrom(Camera.main);
}