[Qt-interest] undefined reference to... collect2: ld returned 1 exit status

M. Bashir Al-Noimi mbnoimi at gmx.com
Sat Mar 27 15:49:45 CET 2010


Hi All,

I've created Two classes (as mentioned below) one of them needs QList so 
I added #include <QObject> but when I tried to create new object from 
these classes I got the following error:

             YSimulate *sim =new  YSimulate(12, 5, 3);

obj/mainwindow.o:Q:\Academic\F09\project1\FactorySimulator/mainwindow.cpp:128: 
undefined reference to `YSimulate::YSimulate(int, int, int)'

collect2: ld returned 1 exit status

mingw32-make[1]: *** [bin\FactorySimulator.exe] Error 1

mingw32-make: *** [debug] Error 2

Exited with code 2.

Error while building project Desktop

When executing build step ''


*How I can fix this issue?*


--snippet ymachine.h--

#if  !defined(_YMACHINE_H)
#define  _YMACHINE_H

#include  "ytausworthe.h"

class  YMachine
{

public:
     explicit  YMachine(int  machineId,int  maintenanceDuration,int  workingDuration);
     explicit  YMachine(int  machineId,int  maintenanceDurationMin,int  maintenanceDurationMax,int  workingDurationMin,int  workingDurationMax);
     int  machineId();
     void  setMachineId(int  machine);
     int  maintenanceDuration();
     void  setMaintenanceDuration(int  duration);
     int  workingDuration();
     void  setWorkingDuration(int  duration);
     int  offTime();
     void  setOffTime(int  time);
     int  maintenanceTime();
     void  setMaintenanceTime(int  time);
     void  setMaintenanceDuration(int  min,int  max);
     void  setWorkingDuration(int  min,int  max);

private:
     int  cl;
     int  clm;
     int  s;
     int  z;
     int  id;
};

#endif   //_YMACHINE_H

--snippet ymachine.h--


#if  !defined(_YSIMULATE_H)
#define  _YSIMULATE_H

#include  <QObject>
#include  "ymachine.h"

class  YSimulate
{
private:
         int  mc;
         QList<YMachine>  f;
         QList<YMachine>  m;
         int  r;
         int  x;
public:
         explicit  YSimulate(int  machines,int  workDuration,int  maintenanceDuration);
         void  stepAhead();
         int  systemClock();
         void  setSystemClock(int  clock);
         QList<YMachine>  workingList();
         QList<YMachine>  maintenanceList();
         int  machinesCount();
         int  findBroken();
         bool  moveToMaintenance(int  machineId);
         bool  workerStatus();
         void  setWorkerStatus(bool  status);
         bool  moveToWork(int  machineId);
};

#endif   //_YSIMULATE_H

In the attachment you can get whole simulation project.



-- 
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100327/5daf6657/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FactorySimulator.zip
Type: application/x-zip-compressed
Size: 85090 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100327/5daf6657/attachment.bin 


More information about the Qt-interest-old mailing list