Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:14:16+00:00 2026-05-27T21:14:16+00:00

I have a problem in compiling a qt example from c++ GUI programming with

  • 0

I have a problem in compiling a qt example from c++ GUI programming with qt 4 second edition book on visual c++ express 2010.Since qt visual studio add-in doesn’t work with express edition , I configured it by myself by just adding library dependencies: qtmaind.lib QtCored4.lib QtGuid4.lib .Also I can compile a sample code ‘Hello,Qt!’ without error.
My project contains two .cpp files and a header file:
findDialog.h:

#ifndef FINDDIALOG_H
#define FINDDIALOG_H

#include <QtGui\qdialog.h>
class QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;

class findDialog : public QDialog
{
    Q_OBJECT
public:
    findDialog(QWidget* parent = 0);
signals:
    void findNext(const QString &str , Qt::CaseSensitivity cs);
    void findPrevious(const QString &str , Qt::CaseSensitivity cs);
private slots:
    void findClicked();
    void enableFindButton(const QString& text);
private:
    QLabel* label;
    QLineEdit* lineEdit;
    QCheckBox* caseCheckBox;
    QCheckBox* backwardCheckBox;
    QPushButton* findButton;
    QPushButton* closeButton;
};
#endif

findDialog.cpp:

#include <QtGui\QtGui>
#include "findDialog.h"


findDialog::findDialog(QWidget* parent) : QDialog(parent)
{
    label = new QLabel(tr("Find &what:"));
    lineEdit = new QLineEdit;
    label->setBuddy(lineEdit);

    caseCheckBox = new QCheckBox(tr("Match &case"));
    backwardCheckBox = new QCheckBox(tr("Search &backward"));

    findButton = new QPushButton(tr("&Find"));
    findButton->setDefault(true);
    findButton->setEnabled(false);

    closeButton = new QPushButton(tr("Close"));

    connect(lineEdit , SIGNAL(textChanged(const QString&)) , this , SLOT(enableFindButton(const QString&)));
    connect(findButton , SIGNAL(clicked()) , this , SLOT(findClicked()));
    connect(closeButton , SIGNAL(clicked()) , this , SLOT(close()));

    QHBoxLayout* topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(label);
    topLeftLayout->addWidget(lineEdit);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addLayout(topLeftLayout);
    leftLayout->addWidget(caseCheckBox);
    leftLayout->addWidget(backwardCheckBox);

    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(findButton);
    rightLayout->addWidget(closeButton);
    rightLayout->addStretch();

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    setLayout(mainLayout);

    setWindowTitle(tr("Find"));
    setFixedHeight(sizeHint().height());
}

void findDialog::findClicked()
{
    QString text = lineEdit->text();
    Qt::CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;

    if(backwardCheckBox->isChecked())
        emit findPrevious(text , cs);
    else
        emit findNext(text , cs);
}

void findDialog::enableFindButton(const QString& text)
{
    findButton->setEnabled(!text.isEmpty());
}

main.cpp:

#include <QtGui\qapplication.h>
#include <iostream>
#include "findDialog.h"



int main(int argc , char* argv[])
{
    QApplication app(argc , argv);
    findDialog* dialog = new findDialog;
    dialog->show();
    return app.exec();
}

When I compile this project , I get 6 link errors :

LNK2001: unresolved external symbol “public: virtual struct QMetaObject const * __thiscall findDialog::metaObject(void)const ” (?metaObject@findDialog@@UBEPBUQMetaObject@@XZ)

LNK2001: unresolved external symbol “public: virtual void * __thiscall findDialog::qt_metacast(char const *)” (?qt_metacast@findDialog@@UAEPAXPBD@Z)

LNK2001: unresolved external symbol “public: virtual int __thiscall findDialog::qt_metacall(enum QMetaObject::Call,int,void * *)” (?qt_metacall@findDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z)

LNK2001: unresolved external symbol “public: static struct QMetaObject const findDialog::staticMetaObject” (?staticMetaObject@findDialog@@2UQMetaObject@@B)

LNK2019: unresolved external symbol “protected: void __thiscall findDialog::findNext(class QString const &,enum Qt::CaseSensitivity)” (?findNext@findDialog@@IAEXABVQString@@W4CaseSensitivity@Qt@@@Z) referenced in function “private: void __thiscall findDialog::findClicked(void)” (?findClicked@findDialog@@AAEXXZ)

LNK2019: unresolved external symbol “protected: void __thiscall findDialog::findPrevious(class QString const &,enum Qt::CaseSensitivity)” (?findPrevious@findDialog@@IAEXABVQString@@W4CaseSensitivity@Qt@@@Z) referenced in function “private: void __thiscall findDialog::findClicked(void)” (?findClicked@findDialog@@AAEXXZ)

Thank you in advance and sorry for my bad english.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:14:17+00:00Added an answer on May 27, 2026 at 9:14 pm

    Perhaps you can solve your problem with a lot of work based on Kia.celever’s diagnosis and further info from

    1. a claim of success
    2. one source (1) is based on
    3. fairly typical posting in QT forum (summary: expect problems)

    But all this work won’t further your knowledge/skills wrt programming in general, c++, or qt. If Visual Studio is important for you, invest in an unrestricted version for professional use and install the add-in and avoid the hassle of configuring a tool for a use it is not meant for. Otherwise, install QT-Creator (see (2); Qt Creator IDE and tools).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with compiling a basic and really simple example of PyGTK
I have a problem when compiling my app, which is inspired from bitmap-plasma. I
I have a problem with compiling an Oracle trigger via SQL*PLUS - I don't
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I'm having trouble compiling the example program presented in section 5.11 of the book.
We are trying to upgrade our code base to use Visual Studio 2010 but
Environment Visual Studio 2008 SP1 Visual C# WPF Application Project .NET Framework 3.5 Problem
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
Hey I have a problem comparing the value of a CGPoint (struct with two
The problem is this: I have multiple competing threads (100+) that need to access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.