Preheat oven to 350 degrees F (175 degrees C). Grease a 9x13-inch baking dish.
Whisk white sugar, vegetable oil, eggs, and 2 teaspoons vanilla extract together in a bowl; stir in flour, baking soda, and salt until batter is well mixed. Fold coconut, carrots, fruit cocktail, and 1 cup walnuts into batter; pour into the prepared baking dish.
Bake in the preheated oven until a toothpick inserted in the center comes out clean, 45 to 50 minutes. Let cake cool to room temperature, about 1 hour.
Beat cream cheese, margarine, and 2 teaspoons vanilla extract together until smooth and creamy; add confectioners' sugar and beat until frosting is smooth. Fold 1 cup walnuts into frosting; spread over cooled cake.