C++ “安装库”;IGRAPHE";对于C/C++;在应用程序文件夹中
在应用程序文件夹中安装C/C++库“IGRAPH”时出现问题 我正在使用Ubuntu 13.04 下载链接: 我正试图基于以下链接安装C/C++的库“IGRAPH”: 请参阅“安装名称”一节 Basic,安装完整的C库C++ “安装库”;IGRAPHE";对于C/C++;在应用程序文件夹中,c++,c,ubuntu,igraph,C++,C,Ubuntu,Igraph,在应用程序文件夹中安装C/C++库“IGRAPH”时出现问题 我正在使用Ubuntu 13.04 下载链接: 我正试图基于以下链接安装C/C++的库“IGRAPH”: 请参阅“安装名称”一节 Basic,安装完整的C库 $ ./configure $ make $ make install 默认情况下,'make install'在/usr/local/bin下安装程序包的命令,在/usr/local/include下包含文件,等等。我希望在我的应用程序目录中安装程序包 我修改了默认安装,
$ ./configure
$ make
$ make install
默认情况下,'make install'
在/usr/local/bin
下安装程序包的命令,在/usr/local/include
下包含文件,等等。我希望在我的应用程序目录中安装程序包
我修改了默认安装,以便:
$ ./configure
$ make
$ make install DESTDIR=~/Desktop/Graph/igraph/
我正在尝试编译以下简短的示例程序:
#include "../usr/local/include/igraph/igraph.h"
int main(void) {
igraph_integer_t diameter;
igraph_t graph;
igraph_erdos_renyi_game(&graph, IGRAPH_ERDOS_RENYI_GNP, 1000, 5.0/1000, IGRAPH_UNDIRECTED, IGRAPH_NO_LOOPS);
igraph_diameter(&graph, &diameter, 0, 0, 0, IGRAPH_UNDIRECTED, 1);
printf("Diameter of a random graph with average degree 5: %d\n", (int) diameter);
igraph_destroy(&graph);
return 0;
}
我正在使用以下命令编译程序:
gcc igraph_test.c -I~/Desktop/Graph/igraph/usr/local/include/igraph -L~/Desktop/Graph/igraph/usr/local/lib -ligraph -o igraph_test
但是,出现以下错误:
/usr/bin/ld: cannot find -ligraph
collect2: error: ld returned 1 exit status
有人能帮我吗?当你调用
gcc
时,试着拼出你的主目录的全名(例如,/Users/whatever/Desktop/Graph/igraph/usr/local/lib
),而不是简单地指定~/Desktop/Graph/igraph/usr/local/lib
。对~/Desktop/Graph/igraph/usr/local/include
执行相同的操作。这就解决了我在机器上遇到的问题。是您正在编译的实际代码,还是它给出的实际错误?或者你的真实代码在第8行是说GRAPH\u UNDIRECTED
,而它应该(可能)说IGRAPH\u UNDIRECTED
?对不起,错误是另一个。修复问题。您是否检查过安装是否将库放置在您期望的位置?也就是说,在~/Desktop/Graph/igraph/usr/local/lib
中是否有libigraph.a
或.so
?是的,所有文件都在这个目录中。有:~/Desktop/Graph/igraph/usr/local/lib e~/Desktop/Graph/igraph/usr/local/include/igraphI-trypkg-config--libs--cflags~/Desktop/Graph/igraph/usr/local/include/igraph
,但不起作用。