linker - Redefinition errors of static variable in C++ -


i have been getting redefinition errors when compile these files. have looked through questions on regarding same, unable find wrong.
here files :-

     #ifndef utility_h      #define utility_h       //------------//      //header files//    //------------// #include <string> #include <map>  #include <fstream>    //----------------------------// /* declaration of class. */  // ---------------------------//   class utility {  public:   static std::ofstream out ;   static std::ofstream music ;    static std::ofstream video ;    static std::ofstream document ;   static std::ofstream mp3 ;    static std::ofstream mp4 ;    static std::ofstream html ;    static std::ofstream deb ;    static std::ofstream cpp ;   static std::ofstream c ;   static std::ofstream py ;    static std::ofstream php ;    static std::ofstream java ;    static std::ofstream _class ;   static std::ofstream ;   static std::ofstream master ;    static std::string lastpath ;   static std::map<std::string, std::string> records ;    static bool openstream() ;  // open stream indexing.   static void index(std::string) ;   // index.   static bool closestream() ; //  close streams after indexing.   static void loadtree() ;  // load tree @ start of application.   static void search(std::string, int) ; // search required keyword.  } ;   #endif  

here utility.cpp file in have implementation :-

    #include "utility.h"      using namespace std ;  /* functions in temp.cpp file fo testing purposes. */   // -------------------------------------------------------// /* definition of static variables outside class. */  // ------------------------------------------------------// ofstream utility::out ; ofstream utility::music ;  ofstream utility::video ; ofstream utility::document ;      string utility::lastpath ;  ofstream utility::mp3 ;  ofstream utility::mp4 ;  ofstream utility::html ; ofstream utility::deb ;  ofstream utility::cpp ;  ofstream utility::c ;   ofstream utility::py ;  ofstream utility::php ; ofstream utility::java ;  ofstream utility::_class ; // because class keyword in c++.  ofstream utility::so ; ofstream utility::master ;  

the errors getting :-

utility.cpp:18:19: error: redefinition of ‘std::ofstream utility::c’ utility.h:72:10: error: ‘std::ofstream utility::c’ declared here

and on every static variable in utility class.

can please tell me doing wrong here ?

the posted header above missing endif. cause bug. transcription error?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -