Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, July 2007
Problem with compiling AddressBook example in eclipse integration


Message 1 in thread

Hi,

I have just downloaded the open source version of qt-4.3.0 and made
the debug libraries. I have also installed the eclipse integration
version 0.0.7 and wanted to follow the cheat-sheet example for the
address book. I started eclipse with the eclipse with mingw menu
option that the integration gave me. I follow the tutorial to the
run/run... item and there I cannot select a local binary.

I open a cmd.exe from the qt menu and cd my way into the eclipse
workspace where the AddressBook example code has been created and run
a simple mingw32-make from the command line. This is the error message
that I get from that process.

Is this a message that someone can understand and help me solve?

C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
cannot find -lqtmaind
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\AddressBook.exe] Error 1
mingw32-make[1]: Leaving directory `C:/usrdat/workspace/AddressBook'
mingw32-make: *** [debug] Error 2

For further information, please don't hesitate to request.

Thanks, and kind regards,
Svenn

--
 [ signature omitted ] 

Message 2 in thread

On 7/10/07, Svenn Are Bjerkem <svenn.bjerkem@xxxxxxxxxxxxxx> wrote:
> Hi,
>

I will answer my own question as it would be of interest to other users.

> C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
> cannot find -lqtmaind
> collect2: ld returned 1 exit status
> mingw32-make[1]: *** [debug\AddressBook.exe] Error 1
> mingw32-make[1]: Leaving directory `C:/usrdat/workspace/AddressBook'
> mingw32-make: *** [debug] Error 2

It turned out that my regular user does not have enough access rights
to compile the debug version. I need to log in as a different user
with more rights and then the make process is able to generate all
nescessary code.

After this I started eclipse from the (now newly installed 1.0 RC of
the eclipse integration) and performed a rebuild on the AddressBook
project. Now eclipse generates a binary file.

Problem solved, case closed :-)

Regards,
Svenn

--
 [ signature omitted ] 

Message 3 in thread

Hi Svenn
  
   Saw ur problem for Address Book. Actually I am also implementing an address book in whcih I am storing User name, Phone Number and Photo of the user. I am using a Structure Triplet for it. M pasting the code of what I am doing.
   
  ///////////////////////////////////////////////////////// Start ////////////////////////////////////////////////////////////////
const char* dataFile = "names.dat";
   
   
  struct Triplet
{
 QString name;
 QString phone;
 QString image;
};
   
   
  void MainWindow::load()
{
 QFile ifile(dataFile);
 if(!ifile.open(QIODevice::ReadOnly))
 {
  QMessageBox::warning(this,tr("Error"),tr("File can't be opened for reading."),QMessageBox::Ok,0);
  return;
 }
 QDataStream ds(&ifile);
 ds.setVersion(QDataStream::Qt_4_1);
 QListWidgetItem *lwt;
 int x;
 ds>>x;
 while(!ds.atEnd())
 {
  lwt = new MyListItem();
  lwt->read(ds);
  listing.addItem(lwt);
 }
 ifile.close();
}
   
   
  void MainWindow::write()
{
 QFile ofile(dataFile);
 if(!ofile.open(QIODevice::WriteOnly))
 {
  QMessageBox::warning(this,tr("Error"),tr("File can't be opened for writing."),QMessageBox::Ok,0);
  return;
 }
 QDataStream ds(&ofile);
 ds.setVersion(QDataStream::Qt_4_1);
 QListWidgetItem *lwt;
 int c = listing.count();
 ds<<c;
 for(int i = 0; i<c; i++)
 {
  lwt = listing.item(i);
  lwt->write(ds);
 }
 ofile.close();
}
   
   
  void MainWindow::addName()
{
 Triplet *t = DispDialog::getData(this,NULL);
 if(t==NULL)
  return;
 MyListItem *lwt = new MyListItem();
 lwt->setText((t->name)+"\n"+(t->phone));
 lwt->setIcon(QIcon(t->image));
 lwt->setBackgroundColor(QColor(255,255,255));
 lwt->setTextColor(QColor(255,0,0));
 lwt->name=t->name;
 lwt->phone=t->phone;
 lwt->image=t->image;
 listing.addItem(lwt);
 delete t;
}
   
   
  AND
   
   
  void MyListItem::read(QDataStream &in)
{
 in>>name;
 in>>phone;
 in>>image;
 QListWidgetItem::read(in);
}
   
  void MyListItem::write(QDataStream &out) const
{
 out<<name;
 out<<phone;
 out<<image;
 QListWidgetItem::write(out);
}
  ////////////////////////////////////////////////////////// End //////////////////////////////////////////////////////
   
   
  THIS CODE WORKED FINE  till QT was configured as Dynamic build. But due to some requirement (running exe on PC where QT is not installed), I configured it as -
   
   
  C:\Qt\4.1.1>configure -debug -static -qt-gif -system-libjpeg
   
  
and then wrote a code to display images as - 
 
In "Main.cpp" ->
 
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)
 
In ".pro" file
 
QTPLUGIN += qjpeg qgif qmng 
 
And in "Makefile.Debug" ->
 
QMAKE_LFLAGS += -L$$[QT_INSTALL_PLUGINS]/imageformats
   
  The problem is that now it terminates the program whenever I call the Write or Load function which saves the Images!! The Write function includes the image in the data base but after hat application terminates. Where as the Load function loads the application but doesn't display the images.
   
  Can u plzz help me to figure out what actually i have done wrong.
   
  Thanks in advance 
   
  Regards,

  Ritzz
India


Svenn Are Bjerkem <svenn.bjerkem@xxxxxxxxxxxxxx> wrote:
  On 7/10/07, Svenn Are Bjerkem wrote:
> Hi,




       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.