0

最近、GSLを使用したプロジェクトがあります。GSLパッケージをMac10.6.3にインストールした後。コードをコンパイルできません。

gsllibは/usr/ local / libにあり、headファイルは/ usr /local/にあります。

コードをコンパイルすると、次のエラーが発生します。makefileで「-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 $@ ${OPT} test_guide.o ${LIBS} 
4

1 に答える 1

2

よくわかりませんが、GSLのBLASライブラリにもリンクする必要があると思います。x86_64の未定義の参照は、同じくらい多くのことを暗示しているようです(blas.oは私が行っているヒントです)。追加するだけ

-lgslcblas

LIBS変数に。

于 2011-05-08T11:31:01.373 に答える