2012-03-14 2 views
0
나는 다음과 같은 코드를 컴파일하려고

에 GSL을 : http://www-personal.umich.edu/~mejn/dcbm/KLOptimization.cppC 컴파일 ++ - x86_64에

을하지만 난에서 다음과 같은 오류 메시지가 g ++ :

> Undefined symbols for architecture x86_64: "_gsl_rng_uniform_int", 
> referenced from: 
>  Initialize()  in ccDEqovL.o 
>  _main in ccDEqovL.o "_gsl_rng_default_seed", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_default", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_alloc", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_name", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_get", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_uniform", referenced from: 
>  _main in ccDEqovL.o "ComputeVI()", referenced from: 
>  _main in ccDEqovL.o "ComputeNMI()", referenced from: 
>  _main in ccDEqovL.o "_gsl_rng_free", referenced from: 
>  _main in ccDEqovL.o ld: symbol(s) not found for architecture x86_64 

나는 맥북 에어는 아이폰 OS 10.7.3를 실행해야 . g ++는 i686-apple-darwin11-llvm-g ++입니다. 4.2. 것 같다

==> Downloading http://ftpmirror.gnu.org/gsl/gsl-1.15.tar.gz 
######################################################################## 100.0% 
==> ./configure --prefix=/usr/local/Cellar/gsl/1.15 
==> make 
==> make install 
Warning: m4 macros were installed to "share/aclocal". 
Homebrew does not append "/usr/local/share/aclocal" 
to "/usr/share/aclocal/dirlist". If an autoconf script you use 
requires these m4 macros, you'll need to add this path manually. 
==> Summary 
/usr/local/Cellar/gsl/1.15: 237 files, 7.0M, built in 81 seconds 
+0

'_gsl_rng_uniform_int'는 어떤 객체입니까? 'ccDEqovL.o'와 링크하고 있습니까? –

+2

GSL 라이브러리를 링크하는 것을 잊어 버린 것 같습니다. 명령 줄에'-lgsl'이 포함되어 있습니까 (컴파일 할 때 필요한 것 같습니다). –

+0

... "/ usr/share/aclocal/dirlist"에 수동으로 "/ usr/local/share/aclocal"경로를 수동으로 추가 했습니까? –

답변

9

는 GSL 라이브러리를 링크하는 것을 잊었다 :

나는 다음과 같은 출력을했다 "양조 설치 GSL"를 사용하여 GSL을 설치했습니다. -lgsl을 추가하면 제대로 작동합니다 (gsl이 라이브러리 경로에 있다고 가정).