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. unresolved external symbol
Forum Updated to NodeBB v4.3 + New Features

unresolved external symbol

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 1.2k Views
  • 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.
  • NevezN Offline
    NevezN Offline
    Nevez
    wrote on last edited by
    #1

    I have a lib file called components and I have a file named example where I use this file.
    I get this error.

    iconbuttonsettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    appbarsettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    avatarsettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    badgesettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    fabsettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    flatbuttonsettingseditor.obj : error LNK2001: unresolved external symbol "public: static class QIcon __cdecl QtMaterialTheme::icon(class QString,class QString)" (?icon@QtMaterialTheme@@SA?AVQIcon@@VQString@@0@Z)
    avatarsettingseditor.obj : error LNK2019: unresolved external symbol "public: __cdecl QtMaterialAvatar::QtMaterialAvatar(class QChar const &,class QWidget *)" (??0QtMaterialAvatar@@QEAA@AEBVQChar@@PEAVQWidget@@@Z) referenced in function "public: __cdecl AvatarSettingsEditor::AvatarSettingsEditor(class QWidget *)" (??0AvatarSettingsEditor@@QEAA@PEAVQWidget@@@Z)
    avatarsettingseditor.obj : error LNK2019: unresolved external symbol "public: void __cdecl QtMaterialAvatar::setUseThemeColors(bool)" (?setUseThemeColors@QtMaterialAvatar@@QEAAX_N@Z) referenced in function "protected: void __cdecl AvatarSettingsEditor::updateWidget(void)" (?updateWidget@AvatarSettingsEditor@@IEAAXXZ)
    

    Example.pro file:

    LIBS += C:/Users/Bim_Desktop2/Desktop/qt-material-widgets-master/qt-material-widgets-master/components/debug/libcomponents.a
    INCLUDEPATH += $$top_srcdir/components/
    TARGET = examples-exe
    PRE_TARGETDEPS += $$top_builddir/components/$(OBJECTS_DIR)/libcomponents.a
    

    whats the problem ?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Do you properly export the QtMaterialTheme class?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • NevezN Offline
        NevezN Offline
        Nevez
        wrote on last edited by
        #3
        This post is deleted!
        Christian EhrlicherC 1 Reply Last reply
        0
        • NevezN Nevez

          This post is deleted!

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Nevez said in unresolved external symbol:

          yes, I think it was exported

          And why do you show me an object file? Did you even read the link I gave you?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • NevezN Offline
            NevezN Offline
            Nevez
            wrote on last edited by
            #5

            I could not see any statement about export in the header files in the Components section.

            #include <QWidget>
            
            #if defined MAKE_TEST_LIB
                #define TEST_LIB_EXPORT Q_DECL_EXPORT
            #else
                #define TEST_LIB_EXPORT Q_DECL_IMPORT
            #endif
                
            class TEST_LIB_EXPORT Widget : public QWidget
            {
                Q_OBJECT
            public:
                Widget(QWidget *parent = nullptr);
            };
            

            the creator of the project did not use such a statement in the header files.

            However, when I compile it with mingw, a lib file with .a extension still occurs. I found this project from github and I want to run i

            1 Reply Last reply
            0
            • NevezN Offline
              NevezN Offline
              Nevez
              wrote on last edited by
              #6
              LIBS += -L"C:/Users/Bim_Desktop2/Desktop/qt-material-widgets-master/qt-material-widgets-master/components/debug/" -llibcomponents.a
              

              This is how I changed the definition in my .pro file and it gave this error

              :-1: error: LNK1104: cannot open file 'libcomponents.a.lib'
              
              JonBJ 1 Reply Last reply
              0
              • NevezN Nevez
                LIBS += -L"C:/Users/Bim_Desktop2/Desktop/qt-material-widgets-master/qt-material-widgets-master/components/debug/" -llibcomponents.a
                

                This is how I changed the definition in my .pro file and it gave this error

                :-1: error: LNK1104: cannot open file 'libcomponents.a.lib'
                
                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @Nevez said in unresolved external symbol:

                -llibcomponents.a

                That is a MinGW library. Are you using the MSVC compiler/linker??

                error: LNK1104

                Yes, you are!

                1 Reply Last reply
                0
                • NevezN Offline
                  NevezN Offline
                  Nevez
                  wrote on last edited by
                  #8

                  yes I noticed that too. I ran it with mingw. It gave this error.
                  Can you help me how exactly should I specify the path?

                  :-1: error: cannot find -llibcomponents.a
                  
                  JonBJ 1 Reply Last reply
                  0
                  • NevezN Nevez

                    yes I noticed that too. I ran it with mingw. It gave this error.
                    Can you help me how exactly should I specify the path?

                    :-1: error: cannot find -llibcomponents.a
                    
                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @Nevez
                    I don't use any of this (not PC). Start by seeing what MinGW linker wants for a library. You have written -llibcomponents.a; for all I know it should actually be -lcomponents or something. (Don't guess: look it up.) And make sure the LIBS path to find it is correct.

                    1 Reply Last reply
                    0

                    • Login

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