将现有库包含到c ++项目中时出现问题 [英] Issues when including an existing library into c++ project

查看:182
本文介绍了将现有库包含到c ++项目中时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 http://libspatialindex.github.com/ 将一个名为libspatialindex的库导入我当前的在netbeans中名为rtreelibrarytest的项目。为了将它导入netbeans,我遵循以下步骤:

I am importing a library called libspatialindex from http://libspatialindex.github.com/ into my current project named "rtreelibrarytest" in netbeans. In order to import the same into netbeans I followed the following steps:


  1. 使用选项=> Build => Linker =>库包括库

  2. 使用File => Project Properties => Build => C ++ Compiler => General => Include Directories(包括目录)

现在当我构建项目以及库时。该库已包括在项目中。我得到以下错误:

Now when I build the project as well as the library. The library has been included in the project. I get the following error:

make[2]: *** No rule to make target `../rtree/spatialindex-src-1.8.0/src/tprtree/.libs/librtree.a', needed by `dist/Debug/GNU-Linux-x86/rtreelibrarytest'.  Stop.

我不知道现在应该怎么做。我也是一个新手c ++。有人可以帮忙。

I am not able to figure out as to what should now. Also I am a novice in c++. Can someone please help.

推荐答案

您不需要指定 include 库文件是。我怀疑这是你的问题。您应该只更改include目录以指向 include 目录,而不是库。

You don't need to specify the include directory where your library file is. I suspect that this is your problem. You should only change the include directory to point at include directories, not libraries.

您的 1。)步骤看起来有效,您的 2。)显示无效。但是,如果尚未存在,则应将路径添加到链接器。

Your 1.) step looks valid, your 2.) appears invalid. You should, however, add the library path to the linker, if not already present.

这篇关于将现有库包含到c ++项目中时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆