Jul 12, 2014 at 2:32am Jul 12, 2014 at 2:32am UTC
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 Jul 12, 2014 at 2:33am Jul 12, 2014 at 2:33am UTC
Jul 12, 2014 at 2:50am Jul 12, 2014 at 2:50am UTC
You are either missing your main function
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 Jul 12, 2014 at 2:51am Jul 12, 2014 at 2:51am UTC
Jul 12, 2014 at 7:16am Jul 12, 2014 at 7:16am UTC
You dont have your main function
Jul 12, 2014 at 12:24pm Jul 12, 2014 at 12:24pm UTC
O_O is that code really yours? i think your compiler does not have class header file
Last edited on Jul 12, 2014 at 12:26pm Jul 12, 2014 at 12:26pm UTC
Jul 12, 2014 at 12:35pm Jul 12, 2014 at 12:35pm UTC
i'm using codeblocks 12.11
Jul 12, 2014 at 12:56pm Jul 12, 2014 at 12:56pm UTC
try search classes.h or classes in the windows start button