1
早些時候,我在Ubuntu 13.10上使用cmake成功編譯了Stasm。它給了我靜態庫libstasm.a。 不過,我嘗試使用Stasm代碼,但每次我試圖G ++的時間來建立自己的節目給了我這樣的:如何將靜態Stasm庫鏈接到我的程序?
[email protected]:~/Desktop$ g++ -Wall -L/home/hanna/Downloads/stasm4.1.0/build -lstasm stasmtest.cpp -o stasmtest
stasmtest.cpp:7:23: fatal error: stasm_lib.h: No such file or directory
#include "stasm_lib.h"
^
compilation terminated.
我試圖編譯在外部庫中的Minimal.cpp例子,因爲這是爲了顯示如何在我自己的程序中使用Stasm,但仍然會出現同樣的錯誤。
有人能告訴我什麼命令我應該用來鏈接Stasm庫到我的程序?
在此先感謝!
Fritzone的回答給了我一些進展。我添加了-I和-L標誌。然而,然後我得到了'stasm_search_single'和其他庫函數的未定義引用。原來,我把錯誤的順序放在旗幟上。 對於任何感興趣的人,我的代碼使用這個命令編譯: 'g ++ file.cpp -Wall -I/direction/to/includes -L/direction/to/libraries -lstasm -o file'pkg-config --cflags - libs opencv'(包括pkg-config部分,代碼格式是關閉的) –
對不起,應該是:'g ++ file.cpp -Wall -I/direction/to/includes -L/direction/to/libraries - lstasm -o file \'pkg-config --cflags --libs opencv \'' –