Results 1 to 4 of 4

Thread: Making Application Plugin-Aware

  1. #1
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Making Application Plugin-Aware

    Sorry for my english ...

    I am trying to developer a Application Plugin-Aware
    following the "C++ GUI Programming with Qt 4 - 2nd Edition" book, but i am having a lot of trouble.

    - I am use the "QT Creator"
    - I am in the windows
    - If a understand, i have to create a .dll file that is is my plugin, and the main app will read.
    - To make the plugin i choose the "C++ Library" option in the IDE

    I am attach the interface and the class that implements its (the is the plugin)

    Error:
    expected class-name before '(' token - Iplugin.h 12
    expected initializer before '*' token - Iplugin.h 18
    return type `struct QStringList' is incomplete - pluginteste.cpp 5
    invalid use of undefined type `struct QStringList' - pluginteste.cpp 6
    forward declaration of `struct QStringList' - qstring.h 86

    Qt Code:
    1. // Iplugin.h
    2.  
    3. #ifndef IPLUGIN_H
    4. #define IPLUGIN_H
    5.  
    6. #include <QtPlugin>
    7.  
    8.  
    9. class QStringList;
    10.  
    11. class Iplugin
    12. {
    13. public:
    14. virtual ~TextArtInterface() { }
    15. virtual QStringList effects() const = 0;
    16.  
    17. };
    18.  
    19. Q_DECLARE_INTERFACE(TextArtInterface,
    20. "com.software-inc.TextArt.TextArtInterface/1.0")
    21.  
    22.  
    23. #endif // IPLUGIN_H
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //pluginteste.h
    2.  
    3. #ifndef PLUGINTESTE_H
    4. #define PLUGINTESTE_H
    5.  
    6. #include <QObject>
    7. #include "Iplugin.h"
    8.  
    9.  
    10. class Pluginteste : public QObject , public Iplugin {
    11.  
    12. Q_OBJECT
    13. Q_INTERFACES(Iplugin)
    14.  
    15. public:
    16. QStringList effects() const;
    17.  
    18. };
    19.  
    20. #endif // PLUGINTESTE_H
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //pluginteste.cpp
    2.  
    3. #include "pluginteste.h"
    4.  
    5.  
    6. QStringList Pluginteste::effects() const
    7. {
    8. return QStringList() << "Plain" << "Outline" << "Shadow";
    9. }
    10.  
    11. Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //pluginteste.pro
    2.  
    3. # -------------------------------------------------
    4. # Project created by QtCreator 2009-04-22T20:24:13
    5. # -------------------------------------------------
    6. QT -= gui
    7. TARGET = pluginteste
    8. TEMPLATE = lib
    9. CONFIG += plugin
    10. SOURCES += pluginteste.cpp
    11. HEADERS += pluginteste.h \
    12. Iplugin.h
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Making Application Plugin-Aware

    Hi,
    Quote Originally Posted by assismvla View Post
    expected class-name before '(' token - Iplugin.h 12
    expected initializer before '*' token - Iplugin.h 18
    This class has no constructor! Name of class and destructor doesn't match! Use also "#include <QStringList>."

    return type `struct QStringList' is incomplete - pluginteste.cpp 5
    invalid use of undefined type `struct QStringList' - pluginteste.cpp 6
    forward declaration of `struct QStringList' - qstring.h 86
    Use "#include <QStringList>" in top of pluginteste.cpp


    ... class Pluginteste has also no constructor. Maybe you want first learn the basics of C++.

  3. #3
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Making Application Plugin-Aware

    I am still recive this error menssages:

    error: expected initializer before '*' token - Iplugin.h 18
    error: expected initializer before '*' token - Iplugin.h 18

    Here is the files ...

    Qt Code:
    1. //Iplugin.h
    2.  
    3. #ifndef IPLUGIN_H
    4. #define IPLUGIN_H
    5.  
    6. #include <QtPlugin>
    7. #include <QStringList>
    8.  
    9.  
    10.  
    11. class Iplugin
    12. {
    13. public:
    14. Iplugin();
    15. virtual ~Iplugin();
    16. virtual QStringList effects() const = 0;
    17.  
    18. };
    19.  
    20. Q_DECLARE_INTERFACE(TextArtInterface,
    21. "com.software-inc.TextArt.TextArtInterface/1.0")
    22.  
    23.  
    24. #endif // IPLUGIN_H
    To copy to clipboard, switch view to plain text mode 



    Qt Code:
    1. //pluginteste.h
    2.  
    3. #ifndef PLUGINTESTE_H
    4. #define PLUGINTESTE_H
    5.  
    6. #include <QObject>
    7. #include <QStringList>
    8. #include "Iplugin.h"
    9.  
    10.  
    11. class Pluginteste : public QObject , public Iplugin {
    12.  
    13. Q_OBJECT
    14. Q_INTERFACES(Iplugin)
    15.  
    16. public:
    17. Pluginteste();
    18. ~Pluginteste();
    19. QStringList effects() const;
    20.  
    21. };
    22.  
    23. #endif // PLUGINTESTE_H
    To copy to clipboard, switch view to plain text mode 



    Qt Code:
    1. //pluginteste.cpp
    2.  
    3. #include "pluginteste.h"
    4. #include <QStringList>
    5.  
    6.  
    7.  
    8. Pluginteste::Pluginteste()
    9. {
    10. }
    11.  
    12. Pluginteste::~Pluginteste()
    13. {
    14. }
    15.  
    16. QStringList Pluginteste::effects() const
    17. {
    18. return QStringList() << "Plain" << "Outline" << "Shadow";
    19. }
    20.  
    21. Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Making Application Plugin-Aware

    As your whole offered code doesn't contain a *, I suggest to clear all previously build things and compile new (rebuild).

Similar Threads

  1. directfb plugin of qte.4.4.3 can not be loaded when running application
    By xianshuiren in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 15th February 2009, 05:54
  2. Need help making plugin
    By vieraci in forum Qt Programming
    Replies: 10
    Last Post: 24th September 2007, 13:20
  3. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  4. Replies: 13
    Last Post: 15th December 2006, 11:52
  5. Application plugin on windows
    By Eyee in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2006, 17:36

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.