News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

not compile qt 4.6.2

Started by mrkcc, April 28, 2010, 09:32:56 AM

Previous topic - Next topic

mrkcc

 #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 ===|



MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]