簡體   English   中英

使用第三方庫(sbpl)

[英]Using a third party library (sbpl)

我已經在linux \\ ubuntu上建立並安裝了一個名為sbpl的庫。 安裝后,我有以下文件:

usr/local/include/sbpl (這里有一堆文件,包括headers.h文件)

usr/local/lib有一個libsbpl.so文件

現在我在編譯一個簡單程序時遇到了一些麻煩:

yus.cpp

#include <iostream>
#include <sbpl/headers.h> 

int main()
{
  EnvironmentType type;
  return 0;
}

使用這些命令進行編譯會出現錯誤:

$ g++ yus.cpp -Iusr/local/include/sbpl   gives the following error 
"error: 'EnvironmentType' was not declared in this scope"

$ g++ yus.cpp -L.-lsbpl   gives the same error as above

如何正確編譯和鏈接庫?

enum EnvironmentType的定義從main.cpp移動到headers.h,然后運行g++ yus.cpp -I/usr/local/include -L/usr/local/lib -lsbpl

暫無
暫無

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

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