Author Topic: not compile qt 4.6.2  (Read 2880 times)

Offline mrkcc

  • Multiple posting newcomer
  • *
  • Posts: 11
not compile qt 4.6.2
« on: April 28, 2010, 09:32:56 am »
 #include <QApplication>
 #include <QStandardItemModel>
 #include <QFile>

 #include "freezetablewidget.h"

 int main( int argc, char** argv )
 {

       //Q_INIT_RESOURCE(grades);

       QApplication app( argc, argv );
       QStandardItemModel *model=new QStandardItemModel();

       QFile file(":/grades.txt");
       QString line;
       QStringList list;
       if (file.open(QFile::ReadOnly)) {
             line = file.readLine(200);
             list= line.simplified().split(",");
             model->setHorizontalHeaderLabels(list);

             int row=0;
             QStandardItem *newItem=0;
             while(file.canReadLine()){
                   line = file.readLine(200);
                   if(!line.startsWith("#") && line.contains(",")){
                         list= line.simplified().split(",");
                         for(int col=0; col<list.length(); col++){
                               newItem = new QStandardItem(list.at(col));
                               model->setItem(row ,col, newItem);
                         }
                         row++;
                   }
             }
       }
       file.close();

      FreezeTableWidget *tableView = new FreezeTableWidget(model);

      tableView->setWindowTitle(QObject::tr("Frozen Column Example"));
       tableView->resize(560,680);
       tableView->show();
       return app.exec();
 }

obj\Debug\main.o||In function `main':|
C:\MRKCC\qt_ejemplo_4.6.2\main.cpp|40|undefined reference to `FreezeTableWidget::FreezeTableWidget(QAbstractItemModel*)'|
||=== Build finished: 1 errors, 0 warnings ===|



Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: not compile qt 4.6.2
« Reply #1 on: April 28, 2010, 04:20:27 pm »
Compiler / linker errors are not within the scope of this forum. You are basically missing to provide the linker the implementation to the method FreezeTableWidget::FreezeTableWidget(QAbstractItemModel*).

Most likely you've only defined it in the header file and forgot to implement it in the source file OR you are missing to link against the file with the implementation.

If still unsure, try a C/C++ or general programming forum. This error is simply not Code::Blocks related.

Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ