Error undefined refference to WinMain@16

Hey everyone..
when i try build and run this program the compiler gives me this error messege
fatal error : classes.h no such file or directory
OR
undefined reference to WinMain@16

main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <windows.h>
#include "classes.h"//error line


using namespace std;



void fill_vector(vector<Manager>& funcVecMan,vector<Vehicle>& funcVecVeh,int signal){
 string name;
    if (signal == 1){
        cout << "\n Enter Names of Managers : ((Type 'done' To Exit))\n";
                cout << " Enter Name Of Manager " << " -> ";
                cin >> name;
                if (name == "done")signal = 0;
                if (signal == 1) {
                    Manager  addDel(name);
                    funcVecMan.push_back(addDel);
                }
                return fill_vector(funcVecMan,funcVecVeh,signal);
            }
........


classes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <string>
#include <iostream>



#ifndef CLASSES_H
#define CLASSES_H

using namespace std;

class Manager {
   string manager;
public:
    Manager();
    Manager(string manName);
    string getName();
};

class  Vehicle {
    string vehName;
    int vehOccupied;
    string manIncharge;
public :
        Vehicle();
        Vehicle (string name);
    void setManIncharge (string nameOfMan);
        int setOccSignal (int signal );
    string getVehName () ;
        string getManIncharge ();
    int getOccStatus();
};
#endif // FUNCTIONS_H


classes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <string>
#include "classes.h"

using namespace std;

//Manager Class Functoins .
Manager::Manager (): manager ("Unset"){}
Manager::Manager(string manName){  this->manager = manName; }
string Manager::getName(){return manager;}

//Vehicle Class Function .
Vehicle::Vehicle (): vehName ("Unset"),vehOccupied (0){}
Vehicle::Vehicle (string name) : vehName(name){};
void Vehicle::setManIncharge (string nameOfMan){
      this->manIncharge = nameOfMan ;  }
int Vehicle::setOccSignal (int signal){
      this->vehOccupied = signal ; }
int Vehicle::getOccStatus(){return vehOccupied ; }
string Vehicle::getVehName () {return vehName; }
string Vehicle::getManIncharge (){return manIncharge ; }

i need immediate help cuz this work is for an assignment .
thanks
Last edited on
You are either missing your main function
1
2
3
4
int main()
{
    ...
}
or you created a windows project instead of a c++ project.

As far as the missing header, is it saved in the same directory as the main.cpp?
Last edited on
You dont have your main function
no i have my main function but the code is long
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

int main () {
    system("color 30");
    vector<Manager> vecManName;
    vector<Vehicle> vecVehName;
    int choice;
    Manager mans;
    Vehicle vehs;
    cout << "\n Hello Boss This Your Manager System Program Choose What You Wish Of The Following :  Press Anykey To Procced \n";
    system("pause");
do{
    system("cls");
    cout << "\n Make A Choice : \n";
    cout << "\n## 1 ## Create Managers   ." <<" ## 2 ## Delete Managers .\n";
    cout << "## 3 ## Create Vehicle    ." <<" ## 4 ## Delete Vehicle  .\n";
    cout << "## 5 ## Display Grid      ." <<" ## 6 ## Assign-Unassign Managers .\n";
    cout <<"## 7 ## Show Whos In-Charge ."<< " ## 8 ## Exchange Vehicles .\n";
    cout << "## 9 ## Costmize Vehicles ." << " ## 10 ## Exit .\n Your Anawer Is --> ";
    cin >> choice;
    system("cls");

    switch (choice){
    case 1 :
       system("color 3");
       fill_vector(vecManName,vecVehName,choice);
       Sleep( 2000 );
       break;
    case 2 :
       system("color 12");
       delete_vector(vecManName,vecVehName,choice);
       Sleep( 2000 );
        break;
    case 3 :
        system("color 3");
        fill_vector(vecManName,vecVehName,choice);
        Sleep( 2000 );
        break;
    case 4 :
        system("color 12");
       delete_vector(vecManName,vecVehName,choice);
       Sleep( 2000 );
        break;
    case 5 :
        system("color 8");
        show_table(vecManName,vecVehName,choice);
        Sleep( 3000 );
        break;

O_O is that code really yours? i think your compiler does not have class header file
Last edited on
i'm using codeblocks 12.11
try search classes.h or classes in the windows start button
Topic archived. No new replies allowed.