QMake 和 wxWidgets(外部库)
我正在尝试编译一个基于 wxWidgets 库的 GUI 程序。我收到很多对“某事”的未定义引用。我尝试在 QMake 的 LIBS 变量上手动添加一些库,但没有成功。如何将所有 wxWidgets 库添加到 QMake 而不对每个库进行硬编码?下面是我的 .pro 文件。
# simple.pro
TARGET = sample
HEADERS += main.h simple.h
SOURCES += main.cpp simple.cpp
LIBS += -LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_core_gcc.dll \
-LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_gcc.dll \
-LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_aui_gcc.dll
INCLUDEPATH += C:/SourceCode/Libraries/wxWidgets2.8/include
CONFIG += release
错误的形式如下:
release/simple.o:simple.cpp:(.rdata$_ZTV6Simple[虚表 简单]+0x320): 未定义的引用 `wxFrameBase::SetStatusBar(wxStatusBar*)'
I'm trying to compile a GUI program based on the wxWidgets libraries. I get a lot of undefined references to "something". I tried to add a few libraries manually on the LIBS variable of QMake without success. How can i add all the wxWidgets libraries to QMake without hard coding each library? Below is my .pro file.
# simple.pro
TARGET = sample
HEADERS += main.h simple.h
SOURCES += main.cpp simple.cpp
LIBS += -LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_core_gcc.dll \
-LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_gcc.dll \
-LC:/SourceCode/Libraries/wxWidgets2.8/lib/gcc_dll/wxmsw28_aui_gcc.dll
INCLUDEPATH += C:/SourceCode/Libraries/wxWidgets2.8/include
CONFIG += release
The errors are of the form:
release/simple.o:simple.cpp:(.rdata$_ZTV6Simple[vtable for
Simple]+0x320): undefined reference to
`wxFrameBase::SetStatusBar(wxStatusBar*)'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要使用 .a 文件添加到链接器。
如果链接到共享库,则需要定义 WXUSINGDLL。
另外,你忘记了
希望有帮助。
First, you need to use the .a files to add to the linker.
Then you need to define WXUSINGDLL if you link against the shared libraries.
Additionally, you forgot
Hope that helps.