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

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


This email contained a .zip file attachment. Raytheon does not allow email attachments that are considered likely to contain malicious code. For your protection this attachment has been removed.

If this email is from an unknown source, please simply delete this email.

If this email was expected, and it is from a known sender, you may follow the below suggested instructions to obtain these types of attachments.

+ Instruct the sender to enclose the file(s) in a ".zip" compressed file, and rename the ".zip" compressed file with a different extension, such as, ".rtnzip".  Password protecting the renamed ".zip" compressed file adds an additional layer of protection. When you receive the file, please rename it with the extension ".zip".

Additional instructions and options on how to receive these attachments can be found at:

http://security.it.ray.com/antivirus/extensions.html
http://security.it.ray.com/news/2007/zipfiles.html

Should you have any questions or difficulty with these instructions, please contact the Help Desk at 877.844.4712

---

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



More information about the Qt-interest-old mailing list