Jump to content

weird project compilation errors regardign includes

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
AoGenius

AoGenius

    Newbie

  • Members
  • Pip
  • 9 posts
I'm getting a lot of errors looking like this:

/usr/include/c++/4.2/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = mEvent]’:

h:107: error: no matching function for call to ‘mEvent::mEvent(const mEvent&)’
../src/../h/../h/mEvent.h:24: note: candidates are: mEvent::mEvent(mEvent&)
../src/../h/../h/mEvent.h:23: note: mEvent:

/usr/include/c++/4.2/bits/stl_uninitialized.h:254: instantiated from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>) [with _InputIterator = mEvent*, _ForwardIterator = mEvent*, _Tp = mEvent]’

where mEvent is a class written in mEvent.h an mEvent.cpp.

I've built it using eclipse on linux.

mEvent constructors look like this:
mEvent();
mEvent(std::string type, Poco::DateTime date, int id, eEnergy _energy, int num, double price);
mEvent(mEvent &other);
the problem is the eclipse IDE doesn't show these problems on the code itself, but only on the console tab. So I'm guessing this isn't a code specific problem.

It showed up after I've wrote a lot of code using the same elements (iterators and Poco utilities), and these new problems showed up after writing a block of code which doesn't even relate to mEvent.

I've also gotten similar errors while trying to compile a method which uses Poco::DateTimeParser, which I copied from code given to me by someone else, said code compiles just fine under the same project (meaning it can't be a problem with the properties, I guess).

help would be appreciated, even though I know this is all sort of vague...

Edited by Jaan, 13 December 2009 - 12:01 PM.
Please use code tags when you are posting your codes!


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You haven't shown us enough code to help you yet. What do your files look like?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
AoGenius

AoGenius

    Newbie

  • Members
  • Pip
  • 9 posts
All right, after a little debugging I found the line which gives all those errors:


void EventContainer::insert(const mEvent &member){

   bool found=false;

   vector<mEvent>::iterator it;

   for(it=_allEvents.begin();it!=_allEvents.end() & !found;it++){}{

      int e=0;//it->compareTo(&member);

      if(e<=0){

         [B]_allEvents.push_back(member);[/B]

	 found=true;

      }

   }

}


and mEvent's constructors:


mEvent::mEvent():_eventType(),

	_date(),_userId(0),_energyType(oil),

	_numOfUnits(0),

	_pricePerUnit(0)

{}


mEvent::mEvent(std::string type, Poco::DateTime date, int id,

		      ass2::eEnergy energy, int num, double price):

      _eventType(type),_date(date),_userId(id),_energyType(energy),

      _numOfUnits(num),_pricePerUnit(price)

{}


mEvent::~mEvent(){}


I'll post the copy constructor and operator= method later as I'm currently trying to rewrite the entire class.