Eumeration Data Type Error

It is another term and so I am back asking more questions about assignments that are giving me problems. Just so you know this is a half completed program so ignorre the majority of the content.  I have three files in my project and I am having issues with getting a enumeration data type working with a struct. I cannot get rid of these related syntax errors:

e:\School\CS 162\Assignments\Main Assignment\MainProject\myheader.h(16): error C2146: syntax error : missing ';' before identifier 'category'

e:\School\CS 162\Assignments\Main Assignment\MainProject\myheader.h(16): error C2501: 'foodItem::Category' : missing storage-class or type specifiers

e:\School\CS 162\Assignments\Main Assignment\MainProject\myheader.h(16): error C2501: 'foodItem::category' : missing storage-class or type specifiers

Here are the copies of the file...

!!!NutritionCalc.cpp Source File:!!!

#include <iostream>
#include <iomanip>
#include "myheader.h"
using namespace std;

enum Category {
            unknown = -1, meat, poultry, seafood, dairy, vegetable,
            fruit, grain, sweet
      };


void displayMenu();
char getCommand();
void completeTask(char command, foodItem foodItemList[], int& size);

void getfoodItem(foodItem & afoodItem);
Category category;


int main()
{
      
      char command;
      
      
      foodItem foodItemList[STORE_CAPACITY];
      int size = 0;
      


      displayMenu();
      command = getCommand();
      while(command != 'q' && command != 'Q')
      {
            completeTask(command, foodItemList, size);
            displayMenu();
            command = getCommand();
      }
      cout << "Thank you for using Cute Video\n" << endl;
      
      return 0;      

}

void displayMenu()
{
      cout << "NutriCalc 1.0" << endl;
      cout << "Created by: Brian Walsh" << endl;
      cout << endl;
      cout << "edit food database" << endl;
      cout << "commands: a<dd>, l<ist>, d<elete> index, m<eal>, q<uit>" << endl;
      cout << "-------------------------------------------------------" << endl;
      
}

char getCommand()
{
      char choice;

      cout << ">";
      cin >> choice;
      cin.ignore(100, '\n');

      return choice;
}

void completeTask(char command, foodItem foodItemList[], int& size)
{
      foodItem myfoodItem;
      

      command = tolower(command);
      switch (command)
      {
      case 'a': getfoodItem(myfoodItem);
                    addfoodItem(myfoodItem, foodItemList, size);
            break;
      case 'l': listfoodItem(foodItemList, size);
            break;
      case 'd': cout << "delete is inoperable for this version." << endl;
            break;
      default: cout << "illegal input" << endl;
            break;
      }
}
void getfoodItem(foodItem& afoodItem)
{
      cout << "name: ";
      cin.get(afoodItem.title, MAX_LEN, '\n');
      cin.ignore(100, '\n');

      cout << "please enter the category(0 for A...): ";
      cin >> afoodItem.category;
      cin.ignore(100, '\n');

      cout << "please enter the quantity: ";
      cin >> afoodItem.quantity;
      cin.ignore(100, '\n');
}

!!!Source File for Functions.cpp:!!!

#include <iostream>
#include <iomanip>
#include "myheader.h"

using namespace std;
void addfoodItem(const foodItem& afoodItem, foodItem foodItemList[], int& size)
{
      foodItemList[size].category = afoodItem.category;
      foodItemList[size].quantity = afoodItem.quantity;
      strcpy(foodItemList[size].title, afoodItem.title);

      size++;      
}

void listfoodItem(foodItem foodItemList[], int size)
{
      cout << setw(10) << "CATEGORY" << setw(30) << "TITLE"
            << setw(10) << "QUANTITY" << endl;

      for(int i=0;i<size; i++)
      {
            cout << setw(10) << foodItemList[i].category
                  << setw(30) << foodItemList[i].title
                  << setw(10) << foodItemList[i].quantity << endl;
      }
}

!!!Source File for myheader.h:!!!

#ifndef MYHEADER_H
#define MYHEADER_H

const int MAX_LEN = 101;
const int ACTION = 0;
const int COMEDY = 1;


const int DRAMA = 2;

const int STORE_CAPACITY = 100;

struct foodItem
{
      char            name[MAX_LEN];      // name of the food
      Category    category;            // what kind of food
      float            calories;            // calories
      float            carbohydrates;      // grams
      float            fat;                  // grams
      float            cholesterol;      // grams
      float            sodium;                  // grams
      float            protein;            // grams

};
void addfoodItem(const foodItem& afoodItem, foodItem foodItemList[], int& size);
void listfoodItem(foodItem foodItemList[], int size);

#endif

THANK YOU SO MUCH AS ALLWAYS!!!
Calv1nAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
instead of:
Category category;
use
enum Category category;
philowareCommented:
//***I think you should define your enum in your header file.
//***Take this part of your code from your .cpp file to .h file
enum Category {
          unknown = -1, meat, poultry, seafood, dairy, vegetable,
          fruit, grain, sweet
     };

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
Move Category definition from cpp file to h file:

// myheader.h

#ifndef MYHEADER_H
#define MYHEADER_H

enum Category {
          unknown = -1, meat, poultry, seafood, dairy, vegetable,
          fruit, grain, sweet
     };


const int MAX_LEN = 101;
const int ACTION = 0;
const int COMEDY = 1;


const int DRAMA = 2;

const int STORE_CAPACITY = 100;

struct foodItem
{
    ...
};

Calv1nAuthor Commented:
Thank you for your help!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.