Results 1 to 9 of 9

Thread: How can I solve this?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I solve this?

    I think you should start looking at the examples and tutorials that are part of the Qt installation to know more about signal & slots and UI development using Qt. Qt Assistant has every thing that you need to get started.

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I solve this?

    Qt Code:
    1. char DLLfunction()
    2. {
    3. QLibrary myLib("dllprog");
    4. typedef char* (*MyPrototype)();
    5. MyPrototype myFunction =
    6. (MyPrototype) QLibrary::resolve("dllprog", "TestDll");
    7. char b = myFunction();
    8. return b;
    9. }
    To copy to clipboard, switch view to plain text mode 
    there is something weird in your code as define MyPrototype as raturning char* and than you do:
    Qt Code:
    1. char b = myFunction();
    To copy to clipboard, switch view to plain text mode 
    where you are assigning returned value to one char. Is it right?
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: How can I solve this?

    a mistake.

    the line now is

    Qt Code:
    1. typedef char (*MyPrototype)();
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: How can I solve this?

    I need a GUI application to display the contents of myFunction. I have a working console application.

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include <QLibrary>
    4. #include <QLineEdit>
    5. MainWindow::MainWindow(QWidget *parent)
    6. : QMainWindow(parent), ui(new Ui::MainWindowClass)
    7. {
    8.  
    9. ui->setupUi(this);
    10.  
    11. QLibrary myLib("dllprog");
    12. typedef char* (*MyPrototype)();
    13. MyPrototype myFunction = (MyPrototype) QLibrary::resolve("dllprog", "TestDll");
    14.  
    15. char* b = myFunction();
    16. ui->lineEdit->setText(b);
    17.  
    18. }
    19.  
    20. MainWindow::~MainWindow()
    21. {
    22. delete ui;
    23. }
    To copy to clipboard, switch view to plain text mode 

    This is my code display the characters that myFunction returns in a linedit.

    I have created a pushButton and a lineEdit in the .ui file.

    I am getting this error.

    :-1: error: collect2: ld returned 1 exit status
    How can i solve this?

    thanks for reading.

Similar Threads

  1. How to solve this cc1plus: out of memory problem?
    By triperzonak in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2008, 20:20
  2. How to solve simultanious equations...??
    By joseph in forum General Programming
    Replies: 2
    Last Post: 28th May 2008, 10:53
  3. start application: Why this error and how to solve it?
    By Colx007 in forum Qt Programming
    Replies: 1
    Last Post: 21st January 2008, 15:22
  4. why qte2.3.1 can kill tty? how to solve it?
    By gwhhwgy in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th July 2006, 19:59
  5. Replies: 12
    Last Post: 3rd April 2006, 06:11

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.