Thread: Redefinition Error

  1. #1
    Unregistered
    Guest

    Redefinition Error

    #include<iostream>
    #include<fstream>
    //#include "TimerType.h" /* Class Redefinition Error */
    #include "ServerList.h"
    #include "CustomerList.h"

    Ok, I have a redefinition error for the class TimerType which is in the header file TimerType.h

    I have TimerType.h included in both ServerList.h and CustomerList.h

    I need to have both of those header files seperate, and have Timer.h included in there. So I need to know how I can incoparate the above headers into my main file without having this error.

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    in "TimerType.h" put some #define in there to mark the inclusion of that file, ie:
    Code:
    #define _TIMERTYPE_H_
    then enclose your header file in a #ifndef statement:
    Code:
    #ifndef _TIMERTYPE_H_
    #define _TIMERTYPE_H_
    
    #define A 3
    #define TAY HAMMER
    #define YOU ME
    #define THREE 4
    ...
    #define AND_IM FINISHED
    
    #endif

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM