Namespace can only contain types and namespace declarations. Please help me

Namespace can only contain types and namespace declarations. Please help me
using UnityEngine;
using System.Collections;
public GameObject targetObject;
public class CameraFollow : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	float targetObjectX = targetObject.transform.position.x; 
    Vector3 newCameraPosition = transform.position;
    newCameraPosition.x = targetObjectX;
    transform.position = newCameraPosition;
	}
}

It looks like your code is this:

using UnityEngine; 
using System.Collections; 
public GameObject targetObject; 

public class CameraFollow : MonoBehaviour {

     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
     float targetObjectX = targetObject.transform.position.x; 
     Vector3 newCameraPosition = transform.position;
     newCameraPosition.x = targetObjectX;
     transform.position = newCameraPosition;
     }
 }

The “public GameObject targetObject;” is outside of the class definition and should be inside the CameraFollow script’s curly braces.

Thank you for your help