undefined reference to spike(..) etc... in CPP

undefined reference to spike(..) etc... in CPP

imagem de Davi Fernandes

Hello,

The libraries link ok with gcc, but I can't link it with g++ icpc when I rename files to *.cpp:

The sources are:

hlp|.c|.cpp|.h same as help|.c|.c|.h, and

ldb|.c|.cpp almost the same as exemple4.c; ldb.h the has functions prototipes

gcc -m64 -O2 -fPIC -Wl,-z,noexecstack src/ldb.c src/hlp.c -o gcc_ldb \\
-I/home/dteodoro/SPIKE/1.0/include \\
-L/home/dteodoro/SPIKE/1.0/lib/em64t \\
-L/opt/software/slurm/lib \\
-lspike -lspike_adapt -lspike_adapt_de -lspike_adapt_grid_f -lspike_mpi_comm_mpich2 \\
-lmkl_solver -lmkl_lapack -lmkl -lguide -lpthread -lpmi -lm \\
-I/usr/include/mpich2-x86_64 \\
-L/usr/lib64/mpich2/lib \\
-L/usr/lib64/mpich2/lib \\
-Wl,-rpath,/usr/lib64/mpich2/lib \\
-lmpich -lopa -lpthread -lrt

executable generated with success!

====================================================================

g++-m64 -O2 -fPIC -Wl,-z,noexecstack src/ldb.cpp src/hlp.cpp -o gcc_ldb \\
-I/home/dteodoro/SPIKE/1.0/include \\
-L/home/dteodoro/SPIKE/1.0/lib/em64t \\
-L/opt/software/slurm/lib \\
-lspike -lspike_adapt -lspike_adapt_de -lspike_adapt_grid_f -lspike_mpi_comm_mpich2 \\
-lmkl_solver -lmkl_lapack -lmkl -lguide -lpthread -lpmi -lm \\
-I/usr/include/mpich2-x86_64 \\
-L/usr/lib64/mpich2/lib \\
-L/usr/lib64/mpich2/lib \\
-Wl,-rpath,/usr/lib64/mpich2/lib \\
-lmpich -lopa -lpthread -lrt

src/ldb.cpp: In function double ComputeMatrixElement(int, int):
src/ldb.cpp:179: warning: converting to int from double
src/ldb.cpp:187: warning: converting to int from double
src/ldb.cpp: In function void DivideDomain(int, int):
src/ldb.cpp:224: warning: converting to int from double
src/ldb.cpp:225: warning: converting to int from double
src/ldb.cpp: In function void fill_dense_lapack_matrix(int, int):
src/ldb.cpp:251: warning: converting to int from double
/tmp/cccrp8hE.o: In function `main':
ldb.cpp:(.text+0x6a0): undefined reference to `spike_default(spike_param_c_interface*)'
ldb.cpp:(.text+0x762): undefined reference to `spike(spike_param_c_interface*, matrix_data_c_interface*, array_dim2*, int*)'
/tmp/ccOft1q2.o: In function `alloc3D_D(array_dim3*, int, int, int)':
hlp.cpp:(.text+0x35d): undefined reference to `spike_allocate_three_double_precision_(array_dim3*, int*, int*, int*, int*)'
/tmp/ccOft1q2.o: In function `alloc2D_D(array_dim2*, int, int)':
hlp.cpp:(.text+0x3a1): undefined reference to `spike_allocate_two_double_precision_(array_dim2*, int*, int*, int*)'
/tmp/ccOft1q2.o: In function `alloc1D_D(array_dim1*, int)':
hlp.cpp:(.text+0x3db): undefined reference to `spike_allocate_one_double_precision_(array_dim1*, int*, int*)'
/tmp/ccOft1q2.o: In function `alloc3D_I(array_dim3*, int, int, int)':
hlp.cpp:(.text+0x42d): undefined reference to `spike_allocate_three_integer_(array_dim3*, int*, int*, int*, int*)'
/tmp/ccOft1q2.o: In function `alloc2D_I(array_dim2*, int, int)':
hlp.cpp:(.text+0x471): undefined reference to `spike_allocate_two_integer_(array_dim2*, int*, int*, int*)'
/tmp/ccOft1q2.o: In function `alloc1D_I(array_dim1*, int)':
hlp.cpp:(.text+0x4ab): undefined reference to `spike_allocate_one_integer_(array_dim1*, int*, int*)'
/tmp/ccOft1q2.o: In function `dealloc(void*)':
hlp.cpp:(.text+0x301): undefined reference to `spike_deallocate_all_type(array_all_dim*)'
/home/dteodoro/SPIKE/1.0/lib/em64t/libspike_adapt_de.so: undefined reference to `char2int_'
collect2: ld returned 1 exit status

====================================================================

icpc obj/spike_help.o obj/lapack_denseband.o -o icpc_ldb \\
-Llib/x86_64 \\
-L/opt/software/slurm/lib \\
-L/usr/lib64/mpich2/lib \\
-lspike -lspike_adapt -lspike_adapt_de -lspike_adapt_grid_f -lspike_mpi_comm_mpich2 \\
-lmpich -lpmi

Same erros as above...

What could be going wrong?

Tank you,

Davi

1 post / 0 new
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.