2011-05-07 6 views
0

최근에 GSL을 사용하는 프로젝트가 있습니다. Mac 10.6.3에 GSL 패키지를 설치 한 후. 내 코드를 컴파일 할 수 없습니다.Mac에서 gsl 사용 10.6.3

gsl lib는/usr/local/lib에 있고 헤드 파일은/usr/local /에 있습니다.

코드를 컴파일 할 때 다음 오류가 발생합니다. 메이크 파일에 "-m32"를 지정하지 않으면 여전히 동일한 오류가 발생하며 "i386"을 "x86_64"로 변경하십시오. 누구든지 나를 도울 수 있습니까?

감사합니다.

#include <gsl/gsl_vector.h> 
#include <gsl/gsl_multiroots.h> 

그런데 내가 위의 gsl을 포함해야합니까? 사실 저는 프로그래밍을 처음 접했습니다.

Undefined symbols for architecture i386: 
"_gsl_vector_get", referenced from: 
    gsl_root_finding::print_state(unsigned long, gsl_multiroot_fdfsolver*)in test_guide.o 
    gsl_root_finding::print_state(unsigned long, gsl_multiroot_fsolver*)in test_guide.o 
    gsl_root_finding::mm_f(gsl_vector const*, void*, gsl_vector*)in test_guide.o 
    gsl_root_finding::process(int, double*, double, double)in test_guide.o 
    gsl_root_finding::mm_fdf(gsl_vector const*, void*, gsl_vector*, gsl_matrix*)in test_guide.o 
    gsl_root_finding::mm_df(gsl_vector const*, void*, gsl_matrix*)in test_guide.o 
"_gsl_vector_set", referenced from: 
    gsl_root_finding::mm_f(gsl_vector const*, void*, gsl_vector*)in test_guide.o 
    gsl_root_finding::process(int, double*, double, double)in test_guide.o 
    gsl_root_finding::mm_fdf(gsl_vector const*, void*, gsl_vector*, gsl_matrix*)in test_guide.o 
    gsl_root_finding::mm_df(gsl_vector const*, void*, gsl_matrix*)in test_guide.o 

ld: symbol(s) not found for architecture i386 
collect2: ld returned 1 exit status 
make: *** [test_guide] Error 1 

빌드 코드 :

CC = g++ 
OPT = -pg -g -I../include -L../libs -I../../Matrix-1.0/include -I../../bessel-1.1/include -L../../Matrix-1.0/libs -L../../bessel-1.1/libs -L/usr/local/lib 
LIBS = -lfmm -lssi -lsparse -lbessel -lg2c -lgfortran -lgsl 
.SUFFIXES : .o .cpp 

test_guide: test_guide.o 
    ${CC} -o [email protected] ${OPT} test_guide.o ${LIBS} 
+0

프로그램을 작성하는 데 사용하는 정확한 명령은 무엇입니까? –

+0

안녕하세요 @Bavarious 저는 빌드 코드를 첨부하여 문제를 파악할 수 있기를 바랍니다. 사전에 감사합니다 –

답변

2

잘 모르겠어요,하지만 난 당신이뿐만 아니라 GSL의 BLAS 라이브러리와 링크해야합니다 생각합니다. 귀하의 x86_64 정의되지 않은 참조 (blas.o 힌트입니다)만큼 암시하는 것으로 보인다. LIBS 변수에

-lgslcblas 

을 추가하십시오.

+0

감사합니다 @rubenvb. -lgslcblas를 추가하면 작동합니다. –

+0

나는이 똑같은 문제를 겪고있다. 정확히 어디에 -lgslcblas를 추가합니까?. 나는 라이브러리를/usr/local/lib에 위치시키고 수동으로 프로젝트에 추가함으로써 해킹을 시도했다. – Eytan

+0

'LIBS' 변수 다음에 makefile에서, 또는 어딘가에서 Xcode에 모릅니다. 나는 Mac에 익숙하지 않다. – rubenvb

관련 문제