全部問候,C++ MinGW共享庫問題(僅限Windows,適用於Linux)?
我爲我的項目使用MinGW,QT和CMake。
如圖中所示,我的項目有兩個模塊。
libRinzoCore.DLL - 共享庫,其定義了一些抽象類和接口和application.This模塊的某些核心功能用於實現動態插件(也共享其由應用程序自動加載的庫) 。
Rinzo.exe - 主要應用程序。它使用「libRinzoCore」類。
「libRinzoCore」主要是使用QT對象開發的,並與QT庫鏈接。
「Rinzo.exe」也使用QT庫對象,有些未在「libRinzoCore」中使用。所以我必須將QT庫和「libRinzoCore」鏈接到該可執行文件。
我可以編譯「libRinzoCore」沒有問題,而且它生成的兩個文件「libRinzoCore.DLL」和「libRinzoCore.DLL.a」
但在編制「Rinzo.exe」它提供了以下的輸出:
Linking CXX executable Rinzo.exe
Info: resolving IRzPlugin::staticMetaObject by linking to __imp___ZN9IRzPlugin16staticMetaObjectE (auto-import)
Info: resolving IRzViewerPlugin::staticMetaObject by linking to __imp___ZN15IRzViewerPlugin16staticMetaObjectE (auto-import)
Info: resolving IRzLayeringPlugin::staticMetaObject by linking to __imp___ZN17IRzLayeringPlugin16staticMetaObjectE (auto-import)
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.
[100%] Built target Rinzo
和執行時「Rinzo.exe」它與消息(這是來自日本的錯誤消息翻譯)
「應用程序不能performe 正確地崩潰(0000005)。點擊[確定] 取消「
這裏是我的CMake文件
libRinzoCore:
http://www.keepandshare.com/doc/2199086/rinzocore-txt-august-31-2010-12-10-pm-2k?da=y
Rinzo.exe:
http://www.keepandshare.com/doc/2199085/rinzo-txt-august-31-2010-12-10-pm-5k?da=y
它的工作原理好,如果我編譯「libRinzoCore」爲一個靜態庫。 在Linux上運行良好。
任何提示?
非常感謝Kamil.You救了我的一天!!!! – 2010-08-31 09:19:06
Qt還提供了一組簡化此步驟的宏。您可以在Qt文檔的[Creating Shared Libraries](創建共享庫)(http://doc.qt.io/qt-5/sharedlibrary.html)一章中找到這些建議。 – SGaist 2017-01-17 15:15:02