使用第三方库(sbpl)

比拉勒27

我已经在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

如何正确编译和链接库?

米林·邓巴(Milind Dumbare)

enum EnvironmentTypemain.cpp的定义移至headers.h,然后运行g++ yus.cpp -I/usr/local/include -L/usr/local/lib -lsbpl

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章