Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Problem sa include file-om

[es] :: C/C++ programiranje :: C/C++ za početnike :: Problem sa include file-om

[ Pregleda: 1882 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

habeg

Član broj: 128380
Poruke: 27
*.dynamic.isp.telekom.rs.



Profil

icon Problem sa include file-om17.08.2010. u 02:25 - pre 165 meseci
Problem je skroz pocetnicki i verovatno je smesan, ali ja ne vidim gde gresim.
Koristim Visual Studio 2008 a projekat Empty Project.
Pri kompajliranju dobijam gresku:

RandomTimedFlowElement.cpp
d:\c++_projects\projekat2010\pr2010\projekat_2010_1.0\randomtimedflowelement.cpp(20) : error C2653: 'Event' : is not a class or namespace name
d:\c++_projects\projekat2010\pr2010\projekat_2010_1.0\randomtimedflowelement.cpp(20) : error C3861: 'create': identifier not found

Ne znam stvarno zasto ne vidi Event klasu...
Moje pitanje je da li moze ova greska da se javi i zbog nekih podesavanja u Project properties.
Molim vas pomagajte.
Kod:

Code:

// Class RandomTimedFlowElement 

// AbstractConcepts
#include "RandomTimedFlowElement.h"
// Event
#include "Event.h"

RandomTimedFlowElement::~RandomTimedFlowElement ()
{

}

// Other Operations (implementation)
void RandomTimedFlowElement::raiseEvent (ID id)
{
    Time tm = 0;
    tm = getTime(id);
    Event::create(this,tm,id);
}



a Event klasa je:

Code:

#ifndef Event_h
#define Event_h 1


#include "Interfaces.h"
//    A discrete occurrence in time, dedicated to an ITimed
//    Element.

class Event 
{
     //..............

      static void create (ITimedElement* targetElement, Time tm, ID id = 0);

      
  protected:
    //.................  
  private:
    //..................
};


// Class Event 

inline void Event::create (ITimedElement* targetElement, Time tm, ID id)
{
    new Event(targetElement,tm,id);
}

//.........................

#endif


 
Odgovor na temu

Mihajlo Cvetanović
Beograd

Moderator
Član broj: 37636
Poruke: 1249



+96 Profil

icon Re: Problem sa include file-om17.08.2010. u 10:12 - pre 165 meseci
Možda je greška u fajlu Interfaces.h. Možda fali ; na kraju deklaracije klase.
 
Odgovor na temu

habeg

Član broj: 128380
Poruke: 27
*.dynamic.isp.telekom.rs.



Profil

icon Re: Problem sa include file-om17.08.2010. u 16:19 - pre 165 meseci
Sad sam pogledao taj file. Ima samo dve klase i obe su ispravne . A osim toga ukljucujem ga i u druge klase koje su ispravno prevedene.
Ceo projekat ima preko 30 klasa a samo ove dve greske koje ne znam kako da otkrijem.
Moze li nekako da se prati kompajliranje u VS? Npr. kada kompajlira .cpp da ispisuje negde gde se nalazi kompajler i sta trenutno radi.
Evo i "Interfaces.h"

Code:

#ifndef Interfaces_h
#define Interfaces_h 1

#include "Types.h"

//    Interface of Flow Elements representing flow sources
//    that can be switched on and off.

class IFlowSource 
{

  public:

      //    Switch the source on - the source can generate or
      //    transport the flow.
      virtual void switchOn () = 0;

      //    Switch the source off - the source does not generate or
      //    transport the flow any more.
      virtual void switchOff () = 0;

      //    Is the source switched on?
      virtual bool isOn () = 0;

    // Additional Public Declarations

  protected:
    // Additional Protected Declarations

  private: 
    // Additional Implementation Declarations

};
//    Interface of a Model Element that has a time delay of
//    some service, for which it should accept a
//    time-scheduled Event from the simulation engine.

class ITimedElement 
{

  public:

      //    Notifies the receiver of the Event that the requested
      //    time delay has elapsed, or the time-scheduled Event has
      //    occurred.
      virtual void notify (ID id    // Auxiliary identification of the Event.
      ) = 0;

    // Additional Public Declarations

  protected:
    // Additional Protected Declarations

  private:
    // Additional Private Declarations

};

#endif
 
Odgovor na temu

Mihajlo Cvetanović
Beograd

Moderator
Član broj: 37636
Poruke: 1249



+96 Profil

icon Re: Problem sa include file-om17.08.2010. u 17:47 - pre 165 meseci
Ako govorimo o Visual Studiu imaš dve pomoćne opcije. Jedna prikazuje sve #include-ove tokom kompajliranja, idi na Properties od RandomTimedFlowElement.cpp, C/C++ > Advanced > Show Includes. Druga opcija umesto .obj fajla proizvodi preprocesirani (mislim .i) fajl, Properties od RandomTimedFlowElement.cpp, C/C++ > Preprocessor > Generate Preprocessed File. Na istom mestu uključi i "Keep Comments", biće ti lakše da se snađeš. Taj .i fajl ume da bude prilično veliki, ali najinteresantnije stvari su pri dnu.
 
Odgovor na temu

[es] :: C/C++ programiranje :: C/C++ za početnike :: Problem sa include file-om

[ Pregleda: 1882 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.