These foods can be made the previous night and refrigerated or frozen. They can be kept cold during the hike by packing them along with frozen box drinks. The drinks will thaw out and you will have a nice chilled drink to refresh yourself with.
Alternately, you could take along non-perishable foods like nuts and crackers. Make sure you carry sufficient water, but if you run out of it, purify the water from streams or lakes by boiling or using purification tablets.
For a long hike, you will need to put some thought into planning your meals. While you can pack the foods suggested earlier for the first day, you will need to carry foods with a longer shelf life for the subsequent days.
Pre-prepared packet meals of rice or noodle base are another way to go. Other option is frozen dried meals, which are expensive but lightweight. It is also possible to prepare your own dehydrated foods. One may be surprised to learn that almost all foods can be dehydrated, from broccoli to lamb stew to mangoes.