Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. LNK 2019: unresolved external symbol "__declspec(dllimport) public: void__thiscall
Forum Updated to NodeBB v4.3 + New Features

LNK 2019: unresolved external symbol "__declspec(dllimport) public: void__thiscall

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lilgoldfish
    wrote on last edited by
    #1

    Error:
    http://puu.sh/3m6Qr.png

    my files

    .pro
    @#-------------------------------------------------

    Project created by QtCreator 2013-06-22T00:33:21

    #-------------------------------------------------

    QT += core gui
    QT += widgets
    QT += network

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = guangdong
    TEMPLATE = app

    SOURCES += main.cpp
    login.cpp

    HEADERS += login.h

    FORMS += login.ui
    @

    login.cpp
    @#include "login.h"
    #include "ui_login.h"
    #include <QtSql/QSql>
    #include <QtSql/QSqlDatabase>
    #include <QDebug>
    #include <Query.h>
    #include <QString>
    #include <QtSql/QSqlQuery>
    #include <QtNetwork/QNetworkInterface>

    login::login(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::login)
    {
    ui->setupUi(this);
    blah();
    }

    login::~login()
    {
    delete ui;
    }
    void login::blah()
    {
    // QSqlQuery query;
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("blah");
    db.setDatabaseName("blah");
    db.setUserName("blah");
    db.setPassword("blah");
    bool ok = db.open();

    if ( ok ) {
        ui->label->setText("databaseopen");
        db.close();
    }
    else
        ui->label->setText("Error opening");
    

    }
    @

    main.cpp
    @#include "login.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    login w;
    w.show();

    return a.exec(&#41;;
    

    }
    @

    I'm not an expert programmer at all, please answer me like i dont know anything, thank you!

    Edit: I am using Qt 5.0.2 and msvc2010 compiler

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Try adding Qt += sql into your .pro file.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved