Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated dynamic library cannot be used in my project #38

Open
wslyw opened this issue Sep 19, 2023 · 0 comments
Open

The generated dynamic library cannot be used in my project #38

wslyw opened this issue Sep 19, 2023 · 0 comments

Comments

@wslyw
Copy link

wslyw commented Sep 19, 2023

Hello, my default development environment is Qt 5.15.2 with MSVC 2019 64-bit, and I have built both the .lib and .dll files using qmake. However, I am encountering compilation errors when trying to use them in my project. I have also attempted to modify the .pro file, but it has not resolved the issue.
Here is the .pro file after my modifications.

TEMPLATE = lib

CONFIG += c++17

DEFINES += ADS_NAMESPACE_ENABLED ADS_EXPORT
QT += core

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

INCLUDEPATH += $$PWD/include

RESOURCES += \
	res/ads.qrc

!isEmpty(target.path): INSTALLS += target
include(AdvancedDockingSystem.pri)

And here is the part in my project related to importing the library and header files.

win32: LIBS += -L$$PWD/lib/ -lAdvancedDockingSystem
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include

The error message is:

error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __cdecl ContainerWidget::ContainerWidget(class QWidget *)" (__imp_??0ContainerWidget@@QEAA@PEAVQWidget@@@Z),函数 "public: __cdecl TableViewForm::TableViewForm(class QWidget *)" (??0TableViewForm@@QEAA@PEAVQWidget@@@Z) 中引用了该符号
tableviewform.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual __cdecl ContainerWidget::~ContainerWidget(void)" (__imp_??1ContainerWidget@@UEAA@XZ),函数 "public: virtual void * __cdecl ContainerWidget::`scalar deleting destructor'(unsigned int)" (??_GContainerWidget@@UEAAPEAXI@Z) 中引用了该符号
tableviewform.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: class SectionWidget * __cdecl ContainerWidget::addSectionContent(class QSharedPointer<class SectionContent> const &,class SectionWidget *,enum DropArea)" (__imp_?addSectionContent@ContainerWidget@@QEAAPEAVSectionWidget@@AEBV?$QSharedPointer@VSectionContent@@@@PEAV2@W4DropArea@@@Z),函数 "public: __cdecl TableViewForm::TableViewForm(class QWidget *)" (??0TableViewForm@@QEAA@PEAVQWidget@@@Z) 中引用了该符号
tableviewform.obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __cdecl ContainerWidget::metaObject(void)const " (?metaObject@ContainerWidget@@UEBAPEBUQMetaObject@@XZ)
tableviewform.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __cdecl ContainerWidget::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@ContainerWidget@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
tableviewform.obj : error LNK2001: 无法解析的外部符号 "public: virtual void * __cdecl ContainerWidget::qt_metacast(char const *)" (?qt_metacast@ContainerWidget@@UEAAPEAXPEBD@Z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant