簡體   English   中英

在運行時加載的C ++動態鏈接庫-Poco / qmake

[英]C++ Dynamically Linked Libraries loaded at runtime - Poco / qmake

我在Boost和Mac OS X上遇到問題。

我將Qt Creator用作C ++項目的開發平台,主要是因為IDE和qmake

現在,我正在開發一個應該跨平台的C ++應用程序,但是我不想使用Qt框架本身。 相反,我使用的是STD(C ++ 11)PocoBoost

我要實現的目標之一是在運行時加載動態鏈接庫的插件系統。

我看到了一些不再受支持的項目,如Boost-extension ,還有其他一些項目。

現在,我正在使用Poco的共享庫及其Class Loader 我將在演講結束時密切關注本教程。 不幸的是,我無法使其正常運行,並且在編譯時收到以下錯誤,其中ServiceBase類是我的插件接口。

Undefined symbols for architecture x86_64:
"Poco::SharedLibrary::getSymbol(std::string const&)", referenced from:
      Poco::ClassLoader<ServiceBase>::loadLibrary(std::string const&, std::string const&) in main.o
  "Poco::SharedLibrary::hasSymbol(std::string const&)", referenced from:
      Poco::ClassLoader<ServiceBase>::loadLibrary(std::string const&, std::string const&) in main.o
  "Poco::SharedLibrary::SharedLibrary(std::string const&)", referenced from:
      Poco::ClassLoader<ServiceBase>::loadLibrary(std::string const&, std::string const&) in main.o
  "Poco::SystemException::SystemException(std::string const&, int)", referenced from:
      Poco::MutexImpl::unlockImpl() in main.o
      Poco::MutexImpl::lockImpl() in main.o
  "Poco::LibraryLoadException::LibraryLoadException(std::string const&, std::string const&, int)", referenced from:
      Poco::ClassLoader<ServiceBase>::loadLibrary(std::string const&, std::string const&) in main.o
ld: symbol(s) not found for architecture x86_64

我鏈接了Poco庫,並且幾乎所有內容似乎都已實現。

關於如何解決該問題的任何建議?

PS我也在尋找實現插件系統的替代方法,可能更強大,而且肯定是跨平台的。

免責聲明。 我沒有使用此Poco庫的經驗。

沒有您的環境或工具的更多詳細信息...我只能提供一些非常一般的建議:

我怎么追求的是:

  1. 在報告為未定義符號的符號中找到定義的庫或目標文件。 在類似Unix的環境中,可以使用nm工具來實現
  2. 驗證庫或對象是在正確的體系結構上編譯的(我看到您正在使用x86_64) 文件工具可能會幫助您
  3. 驗證您是在鏈接器命令行中引用該庫(對於動態庫還是靜態庫,請查找-l),或者在要鏈接的事物列表中包括目標文件或靜態庫。
  4. 驗證您引用的是正確的庫(通過-L標志或LD_LIBRARY_PATH env變量(或在某些系統中,例如LD_LIBRARY_PATH_64,例如用於64位的Solaris)

我知道您說您已經鏈接了Poco庫,但是錯誤顯然是缺少一個符號。 庫丟失了,或者您需要弄亂-l標志的順序來滿足依賴性。 nm可能會幫助您確定哪些對象或庫引用了該符號(必須在最前面)以及哪些對象或庫定義了該符號(必須在后面)。

抱歉,沒有更多幫助。

PS此外,您可能想查看可能與Poco Net相關的鏈接錯誤

關於此問題的另一個參考,詳細說明了鏈接器錯誤的各種原因: 什么是未定義的參考/未解決的外部符號錯誤,如何解決?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM