Results 1 to 3 of 3

Thread: [SOLVED]mainwindow.obj:-1: error: LNK2019: unresolved external symbol

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2013
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default [SOLVED]mainwindow.obj:-1: error: LNK2019: unresolved external symbol

    I try to compile my program and I get the following errors:

    Qt Code:
    1. mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall FullGraph::FullGraph(class QWidget *)" (??0FullGraph@@QAE@PAVQWidget@@@Z) referenced in function "private: void __thiscall MainWindow::on_actionExample_triggered(void)" (?on_actionExample_triggered@MainWindow@@AAEXXZ)
    2.  
    3. mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall FullGraph::setID(int)" (?setID@FullGraph@@QAEXH@Z) referenced in function "private: void __thiscall MainWindow::on_go_button_clicked(void)" (?on_go_button_clicked@MainWindow@@AAEXXZ)
    4.  
    5. debug\GraphIt.exe:-1: error: LNK1120: 2 unresolved externals
    To copy to clipboard, switch view to plain text mode 

    This is my code:

    mainwindow.h

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QtGui>
    6. #include <QtCore>
    7. #include <QFileDialog>
    8.  
    9. #include "fullgraph.h"
    10.  
    11. namespace Ui {
    12. class MainWindow;
    13. }
    14.  
    15. class MainWindow : public QMainWindow
    16. {
    17. Q_OBJECT
    18.  
    19. public:
    20. explicit MainWindow(QWidget *parent = 0);
    21. ~MainWindow();
    22.  
    23. public slots:
    24.  
    25. private:
    26. Ui::MainWindow *ui;
    27. FullGraph *new_graph;
    28.  
    29. private slots:
    30. void on_actionAbout_triggered();
    31. void on_actionQuit_Alt_F4_triggered();
    32. void on_actionExample_triggered();
    33. void on_pushButton_clicked();
    34. void on_go_button_clicked();
    35. };
    36.  
    37. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 


    mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include "about.h"
    4. #include "fullgraph.h"
    5.  
    6.  
    7. #include <stdio.h>
    8. #include <string.h>
    9.  
    10.  
    11.  
    12. MainWindow::MainWindow(QWidget *parent) :
    13. QMainWindow(parent),
    14. ui(new Ui::MainWindow)
    15. {
    16. ui->setupUi(this);
    17. }
    18.  
    19. MainWindow::~MainWindow()
    20. {
    21. delete ui;
    22. }
    23.  
    24. void MainWindow::on_actionAbout_triggered(){
    25. About new_about;
    26.  
    27. new_about.setModal(true);
    28. new_about.exec();
    29. }
    30.  
    31. void MainWindow::on_actionQuit_Alt_F4_triggered(){
    32. close();
    33. }
    34.  
    35.  
    36. void MainWindow::on_actionExample_triggered()
    37. {
    38.  
    39. new_graph = new FullGraph(this);
    40. new_graph->show();
    41.  
    42. }
    43.  
    44. void MainWindow::on_pushButton_clicked()
    45. {
    46. QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
    47. "",
    48. tr("Files (*.*)"));
    49.  
    50. ui->fp_input->setText(fileName);
    51. }
    52.  
    53.  
    54. void MainWindow::on_go_button_clicked()
    55. {
    56. QString _input = ui->fp_input->text();
    57. QFile file_in(_input);
    58.  
    59. //INI LABEL TEXT
    60. ui->error->setText(" ");
    61.  
    62. //CHECK FILE EXISTANCE
    63. if(!file_in.open(QIODevice::ReadOnly | QIODevice::Text)){
    64. ui->error->setText("File doesn't exist");
    65. return;
    66. }
    67. QTextStream text(&file_in);
    68.  
    69.  
    70. file_in.close();
    71.  
    72. new_graph = new FullGraph(this);
    73. int _id = ui->id_input->text().toInt();
    74. new_graph->setID(_id);
    75. new_graph->show();
    76. }
    To copy to clipboard, switch view to plain text mode 


    fullgraph.h
    Qt Code:
    1. #ifndef FULLGRAPH_H
    2. #define FULLGRAPH_H
    3.  
    4. #include <QDialog>
    5. #include <QtGui>
    6. #include <QtCore>
    7.  
    8. namespace Ui {
    9. class FullGraph;
    10. }
    11.  
    12. class FullGraph : public QDialog
    13. {
    14. Q_OBJECT
    15.  
    16. public:
    17. explicit FullGraph(QWidget *parent = 0);
    18. ~FullGraph();
    19. void setID(int _ID);
    20.  
    21. private slots:
    22. void on_browse_fpout_clicked();
    23. void on_saveit_clicked();
    24.  
    25. private:
    26. Ui::FullGraph *ui;
    27. int ID;
    28.  
    29. };
    30.  
    31. #endif // FULLGRAPH_H
    To copy to clipboard, switch view to plain text mode 


    fullgraph.cpp
    Qt Code:
    1. #include "fullgraph.h"
    2. #include "ui_fullgraph.h"
    3.  
    4. FullGraph::FullGraph(QWidget *parent) :
    5. QDialog(parent),
    6. ui(new Ui::FullGraph)
    7. {
    8. ui->setupUi(this);
    9. ID = 0;
    10.  
    11. //create graphicsview
    12. scene = new QGraphicsScene(this);
    13. ui->graphicsView->setScene(scene);
    14.  
    15. //set cross background
    16. QBrush brush(Qt::gray, Qt::CrossPattern);
    17. scene->setBackgroundBrush(brush);
    18.  
    19. }
    20.  
    21. FullGraph::~FullGraph()
    22. {
    23. delete ui;
    24. }
    25.  
    26. void FullGraph::setID(int _ID)
    27. {
    28.  
    29. ID = _ID;
    30.  
    31. }
    32.  
    33. void FullGraph::on_browse_fpout_clicked()
    34. {
    35. QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
    36. "",
    37. tr("Portable Network Graphics (*.png)"));
    38. ui->filename_out->setText(fileName);
    39. }
    40.  
    41. void FullGraph::on_saveit_clicked()
    42. {
    43. QString fileName = ui->filename_out->text();
    44.  
    45. QImage *image = new QImage(382, 238, QImage::Format_ARGB32_Premultiplied);
    46. QPainter *p = new QPainter(image);
    47. p->setRenderHint(QPainter::Antialiasing);
    48. scene->render(p);
    49. p->end();
    50.  
    51. // Save it..
    52. image->save(fileName, "PNG");
    53. }
    To copy to clipboard, switch view to plain text mode 


    I do realise the code is highly incomplete, as it does barely nothing at all. I just wanted to check if all this is right before I started codding the rest.
    I've checked a lot of forums and threads about this but nothing helped, so I started this one.

    Thank you in advance
    Last edited by bshikari; 11th February 2013 at 22:29.

Similar Threads

  1. Replies: 2
    Last Post: 8th February 2013, 19:52
  2. error LNK2019: unresolved external symbol
    By 8080205 in forum Newbie
    Replies: 3
    Last Post: 3rd October 2012, 15:53
  3. Help - LNK2019: Unresolved external symbol
    By marc2050 in forum Newbie
    Replies: 3
    Last Post: 17th May 2011, 01:29
  4. Replies: 3
    Last Post: 29th April 2011, 09:13
  5. Replies: 4
    Last Post: 5th January 2011, 15:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.