은 내가 참조 문제를 정의되지 않은 한, 완벽하게 그러나 C.사용 IGRAPH 객체 지향 프로그래밍
에서 코드에 대한작업 igraph 라이브러리를 가지고있다. 일부 기능은 작동하지만 일부 기능은 작동하지 않습니다. 나는 빠진 것이 나의 연구에 근거하여 "igraph.hpp"를 포함시키는 것이라고 믿는다. 비록, 나는 어떻게 이러한 파일을 설치 해야할지 모르겠다.
는 나는 다음과 같은 예제 프로그램 컴파일 시도하고:
#include <iostream>
#include <igraph.h>
using namespace std;
int main() {
igraph_t g;
FILE *ifile;
int i;
igraph_sparsemat_t temp;
ifile=fopen("karate.gml", "r");
if (ifile==0) printf("erro");
igraph_read_graph_gml(&g, ifile);
fclose(ifile);
i=igraph_get_sparsemat(&g, &temp);
return 0;
}
나는 명령을 사용하여 프로그램을 컴파일하고 있습니다 :
g++ teste.cc -I/usr/local/include/igraph -L/usr/local/lib -ligraph -o teste
하지만를,이 오류가 발생합니다
teste.cc:(.text+0x77): referência indefinida para `igraph_get_sparsemat(igraph_s const*, igraph_sparsemat_t*)'
collect2: error: ld returned 1 exit status
아무도 도와 줄 수 있습니까?
라이브러리가'C'이므로'extern "C"블록을 실행하고 그 안에'#include '를 삽입해야합니다. – cybermonkey