Tôi mới sử dụng Qt và có một lỗi mà tôi không thể khắc phục được.Lỗi tham chiếu không xác định Qt/mingw32 ... không thể liên kết .lib
Tôi có một nhóm cửa sổ (VS2005) tệp thư viện tĩnh (.lib
). Và tôi đang thử nghiệm nếu họ làm việc tốt với Qt. Vì vậy, tôi đã lấy thư viện đơn giản nhất mà tôi có. (Được gọi là MessageBuffer
).
Vì vậy, tôi đã thêm MessageBuffer.h
vào main.cpp
và thêm vị trí của những tệp đó vào INCLUDEPATH
của .pro
.
Cho đến lúc đó mọi thứ có vẻ ổn, tôi có thể sử dụng lớp và IDE Qt hiển thị tất cả phương thức và mọi thứ. Vì vậy, với tôi nó trông giống như nó tìm thấy tập tin .h.
Bây giờ tôi thêm MessageBuffer.lib
(VS2005/Debug xây dựng) trong .pro
như thế này:
LIBS += E:/SharedLibrary/lib/MessageBufferd.lib
Tôi cũng đã thử như sau:
win32:LIBS += E:/SharedLibrary/lib/MessageBufferd.lib
LIBS += -LE:/SharedLibrary/lib -lMessageBufferd
win32:LIBS += -LE:/SharedLibrary/lib -lMessageBufferd
Dưới đây là nội dung của tập tin .pro
của tôi :
QT += opengl
TARGET = SilverEye
TEMPLATE = app
INCLUDEPATH += E:/SharedLibrary/MessageBuffer
SOURCES += main.cpp \
silvereye.cpp
HEADERS += silvereye.h
FORMS += silvereye.ui
OTHER_FILES +=
win32:LIBS += E:/SharedLibrary/lib/MessageBufferd.lib
Tất cả đều cho tôi cùng một công cụ xóa rs: (và tôi nhận được cùng một ngay cả khi tôi không bao gồm các .lib
)
Running build steps for project SilverEye...
Configuration unchanged, skipping QMake step.
Starting: C:/Qt/2009.03/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye'
C:/Qt/2009.03/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\SilverEye.exe debug/main.o debug/silvereye.o debug/moc_silvereye.o -L"c:\Qt\2009.03\qt\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind E:/SharedLibrary/lib/MessageBufferd.lib -lQtOpenGLd4 -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye'
mingw32-make: Leaving directory `C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye'
debug/main.o: In function `Z5qMainiPPc':
C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye/main.cpp:12: undefined reference to `MessageBuffer::MessageBuffer()'
C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye/main.cpp:13: undefined reference to `MessageBuffer::Append(char*, int)'
C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye/main.cpp:17: undefined reference to `MessageBuffer::~MessageBuffer()'
C:/Documents and Settings/JP/My Documents/QTProjects/SilverEye/main.cpp:17: undefined reference to `MessageBuffer::~MessageBuffer()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\SilverEye.exe] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project SilverEye
When executing build step 'Make'
Bất cứ ai có thể giúp đỡ?
Bạn có thể đăng file pro bạn đang sử dụng? –
vừa thêm nội dung tệp chuyên nghiệp vào thư gốc. –
cảm ơn. pro tập tin có vẻ tốt. –