unresolved external symbol
-
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 ?
-
Do you properly export the QtMaterialTheme class?
-
@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?
-
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
-
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'
-
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'
-
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
@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 theLIBS
path to find it is correct.