Thread: compilation error message

  1. #1
    Registered User
    Join Date
    Mar 2006

    compilation error message

    Hi, any help will be much appreciated.

    I'm compiling with the command:
    g++ -Wall -o LQueue.C Simulation.C

    The message I get is:
    Undefined first referenced symbol in file main

    #include <iostream>
    #include <ctime>
    #ifndef SIMULATION
    #define SIMULATION
    #include "LQueue.h"
    class Simulation
        /***** Function Members *****/
    	  /***** Constructor *****/
    	    Construct a Simulation object.
    		Precondition: None.
    		Postcondition: Input data members have been initialized 
    			with values entered by the user; output data members have 
    			been initialized to 0; and random number generator has 
    			been initialized.
    	  /***** Running the simulation *****/
    	  void run();
    	    Run the simulation.
    		Precondition: None.
    		Postcondition: Simulation of airport runway management 
    			has been completed and performance statistics is 
    	  /***** Output *****/
    	  void display(ostream & out);
    	    Display results of the simulation.
    		Precondition: ostream out is open.
    		Postcondition: Simulation process is printed.
    	  /***** Plane processing *****/
    	  void managePlanes();
    	    Manage planes (if any) at the front of landing or takeoff 
    		Precondition: freeRunway is true.
    		Postcondition: Planes are dequeued and put on runway.
    	  void checkForNewPlane();
    	    Check if a new plane has arrived and if so, add it to the 
    		takeoff queue or landing queue depending on different
    		circumstances. ((STAR - on h/o))
    		Precondition: none.
    		Postcondition: takeoff queue or landing queue has been updated.
    	  /***** Data Members *****/
    	    //-- Inputs
    	    double takeoffRate; //in terms of hrs
    		double landingRate; //in terms of hrs
    		int landTimeDuration; //in terms of mins
    		int takeoffTimeDuration; //in terms of mins
    		int lengthOfSimulation; //in mins
    		//-- Stats
    		int maxPlanesInLandingQ;
    		int avgTimeSpentWaitingToLand; //mins
    		int maxPlanesInTakeoffQ;
    		int avgTimeSpentWaitingToTakeoff; //mins
    		int landingTime;
    		int takeoffTime;
    		bool freeRunway; //some plane is in the process of landing (or not) (if plane takesoff, it's "done") (TRIANGLED)
    		int totalMinsWaitingToLand;
    		int totalMinsWaitingToTakeoff;
    		Queue takeoffQ;
    		Queue landingQ;

  2. #2
    Registered User
    Join Date
    Mar 2006
    #include <iostream> // istream, ostream, >>, <<
    #include <cstdlib> // rand(), srand()
    #include <ctime> //time()
    using namespace std;
    #include "Simulation.h"
    	//-- Initialize output stats
    	maxPlanesInLandingQ = 0;
    	avgTimeSpentWaitingToLand = 0; //mins
    	maxPlanesInTakeoffQ = 0;
    	avgTimeSpentWaitingToTakeoff = 0; //mins
    	freeRunway = false;
    	totalMinsWaitingToLand = 0;
    	totalMinsWaitingToTakeoff = 0;
    	//-- get input
    	cout << "Enter:/n" 
    		 << "Time for a plane to land (in minutes): ";
    		 cin >> landingTime; 
    void Simulation::run()
    void Simulation::display(ostream & out)
    void Simulation::managePlanes()
    void Simulation::checkForNewPlane()

  3. #3
    Registered User
    Join Date
    Mar 2006
    For sure, there's nothing wrong with LQueue.C and LQueue.h because I've tested those separately.

  4. #4
    Registered User
    Join Date
    Mar 2006
    LOL It turns out I got the error because I didn't have a driver program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PC RAM in Compilation
    By SlyMaelstrom in forum Tech Board
    Replies: 5
    Last Post: 05-21-2006, 06:03 AM
  2. Inconsistent Compilation
    By GlassEyeSlim in forum Linux Programming
    Replies: 2
    Last Post: 02-23-2006, 06:43 PM
  3. Compilation units
    By filler_bunny in forum C++ Programming
    Replies: 0
    Last Post: 10-21-2003, 03:57 AM
  4. MS VC++ Crash on compilation
    By Magos in forum A Brief History of
    Replies: 10
    Last Post: 08-23-2003, 07:06 PM
  5. malloc problem in SUN in 64-bit compilation
    By ylzhang in forum C Programming
    Replies: 6
    Last Post: 05-31-2003, 11:48 AM