2017-01-11 36 views
0

我想從DocxFactory編譯一個最小的例子。該示例取自C++ Tutorial編譯基於DocxFactory的應用程序與gcc

其中執行以下步驟:

top_level.cpp:

#include "WordProcessingCompiler.h" 
#include <exception> 
#include <iostream> 
#include <ctime> 
using namespace DocxFactory; 
using namespace std; 
int main() 
{ 
    try 
    { 
     WordProcessingCompiler& l_compiler = 
      WordProcessingCompiler::getInstance(); 
     time_t l_start = clock(); 
     l_compiler.compile(
      "/opt/DocxFactory/exercises/templates/top_level_items.docx", 
      "/opt/DocxFactory/exercises/templates/top_level_items.dfw"); 
     cout<< "Completed (in " 
      << (double) (clock() - l_start)/CLOCKS_PER_SEC 
      << " seconds)." 
      << endl; 
    } 
    catch (const exception& p_exception) 
    { 
     cout << p_exception.what() << endl; 
    } 
} 

之後,它會被編譯,寫在本教程中,有:

g++ -c top_level.cpp /opt/DocxFactory/src/WordProcessingCompiler.cpp /opt/DocxFactory/src/WordProcessingMerger.cpp -I/opt/DocxFactory/include 

最後的鏈接失敗,

g++ -o top_level top_level.o WordProcessingCompiler.o WordProcessingMerger.o -L/opt/DocxFactory/lib -lDocxFactory 
//opt/DocxFactory/lib/libDocxFactoryLib.so: undefined reference to `ZBarcode_Export' 
collect2: error: ld returned 1 exit status 

因爲這是一個鏈接錯誤,很顯然,一個或多個缺少額外的動態庫。

問題

  • 別的任何人運行到同樣的問題,解決它了嗎?
  • 什麼庫包含名稱爲ZBarcode_Export的函數或類?

回答

1

DocxFactory使用Zint生成條形碼。 libzint.so是Zint共享庫。

你設置了LD_LIBRARY_PATH還是使用了ldconfig?

親切的問候, 阿隆