Results 1 to 5 of 5

Thread: Problem with class type for dll

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2019
    Posts
    4
    Thanks
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Problem with class type for dll

    Hi All,

    I have been trying to create a shared library using guidelines from the article https://doc.qt.io/qt-5/sharedlibrary.html :

    Qt .pro :profile1.pro

    Qt Code:
    1. QT += qml quick core
    2.  
    3.  
    4. TARGET = profile1
    5. TEMPLATE = lib
    6.  
    7. DEFINES += PROFILE1_LIBRARY
    8.  
    9. # The following define makes your compiler emit warnings if you use
    10. # any feature of Qt which has been marked as deprecated (the exact warnings
    11. # depend on your compiler). Please consult the documentation of the
    12. # deprecated API in order to know how to port your code away from it.
    13. DEFINES += QT_DEPRECATED_WARNINGS
    14.  
    15.  
    16.  
    17. # You can also make your code fail to compile if you use deprecated APIs.
    18. # In order to do so, uncomment the following line.
    19. # You can also select to disable deprecated APIs only up to a certain version of Qt.
    20. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
    21.  
    22. SOURCES += \
    23. profile1.cpp
    24.  
    25. HEADERS += \
    26. profile1.h \
    27. profile1_global.h
    28.  
    29. unix {
    30. target.path = /usr/lib
    31. INSTALLS += target
    32. }
    To copy to clipboard, switch view to plain text mode 



    Main header
    :profile1_global.h

    Qt Code:
    1. #ifndef PROFILE1_GLOBAL_H
    2. #define PROFILE1_GLOBAL_H
    3.  
    4. #include <QtCore/qglobal.h>
    5.  
    6.  
    7. #if defined(PROFILE1_LIBRARY)
    8. # define PROFILE1SHARED_EXPORT Q_DECL_EXPORT
    9. #else
    10. # define PROFILE1SHARED_EXPORT Q_DECL_IMPORT
    11. #endif
    12.  
    13. #endif // PROFILE1_GLOBAL_H
    To copy to clipboard, switch view to plain text mode 

    Header :profile1.h

    Qt Code:
    1. #ifndef PROFILE1_H
    2. #define PROFILE1_H
    3.  
    4.  
    5. #include "profile1_global.h"
    6.  
    7.  
    8. class PROFILE1SHARED_EXPORT Profile1
    9. {
    10.  
    11. public:
    12.  
    13. Profile1();
    14. void func1();
    15.  
    16. };
    17.  
    18.  
    19. #endif // PROFILE1_H
    To copy to clipboard, switch view to plain text mode 



    Code : profile1.cpp

    Qt Code:
    1. #include "profile1.h"
    2. #include <stdio.h>
    3. #include <string.h>
    4. #include <unistd.h>
    5. #include <fcntl.h>
    6.  
    7.  
    8. Profile1::Profile1()
    9. {
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 




    I keep getting an error for class declaration : class PROFILE1SHARED_EXPORT Profile1 -" variable has incomplete type 'class Q_DECL_EXPORT' "
    Thank you in advance for your help.
    Attached Images Attached Images
    Last edited by cleopa; 28th May 2020 at 17:05.

Similar Threads

  1. What is Type information when creating Class
    By vinothrajendran in forum Qt Tools
    Replies: 1
    Last Post: 20th March 2015, 12:11
  2. 'CLASS' does not name a type
    By plopes21 in forum General Programming
    Replies: 4
    Last Post: 27th August 2013, 03:42
  3. Replies: 10
    Last Post: 1st May 2011, 18:27
  4. 'Class' does not name a type error
    By naturalpsychic in forum Qt Programming
    Replies: 9
    Last Post: 1st February 2011, 15:43
  5. Determine Class Type of QObject Parent
    By photo_tom in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2010, 17:42

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.