LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Tim Prins (tprins_at_[hidden])
Date: 2007-11-15 11:23:18


Try using the fortran compiler to do the linking. I.e. replace:
          $(CC) globalMain.o functF.o -o go

with
          $(FC) globalMain.o functF.o -o go

Hope this helps,

Tim

Serge Van Criekingen wrote:
> Hello,
>
> I am trying to call a g95 fortran routine from a C(++) main file.
> Here are the 2 files:
> globalMain.c:
> #include <iostream>
> using namespace std;
> extern"C" {
> void fortfunc_(int *ii, float *ff);
> }
> int main( int argc , char* argv[] )
> {
> int ii=5;
> float ff=5.5;
> fortfunc_(&ii, &ff);
> return 0;
> }
>
> functF.f:
> subroutine fortfunc(ii,ff)
> integer ii
> real*4 ff
> write(6,100) ii, ff
> 100 format('ii=',i2,' ff=',f6.3)
> return
> end
>
> I installed (without any problem) the lam mpi with the g95 fortran compiler.
> My makefile is:
> CC=mpiCC
> FC=mpif77
>
> each:
> $(CC) -c globalMain.c
> $(FC) -c -fno-second-underscore -fno-underscoring functF.f
>
> all:
> $(CC) globalMain.o functF.o -o go
>
> As a result, "make each" runs find: no error message.
> But "make all" fails:
> mpiCC globalMain.o functF.o -o go
> functF.o: In function `fortfunc':
> functF.f:(.text+0x19): undefined reference to `_g95_get_ioparm'
> functF.f:(.text+0x20): undefined reference to `_g95_filename'
> functF.f:(.text+0x2b): undefined reference to `_g95_line'
> functF.f:(.text+0x3e): undefined reference to `_g95_ioparm'
> functF.f:(.text+0x4c): undefined reference to `_g95_ioparm'
> functF.f:(.text+0x5b): undefined reference to `_g95_ioparm'
> functF.f:(.text+0x6d): undefined reference to `_g95_ioparm'
> functF.f:(.text+0x7d): undefined reference to `_g95_st_write'
> functF.f:(.text+0x8b): undefined reference to `_g95_transfer_integer'
> functF.f:(.text+0x99): undefined reference to `_g95_transfer_real'
> functF.f:(.text+0x9e): undefined reference to `_g95_st_write_done'
> collect2: ld returned 1 exit status
> mpiCC: No such file or directory
> make: *** [all] Error 1
>
> Attached is my config.log, and below the laminfo output.
> Any comment will be greatly appreciated. Thanks.
> Serge Van Criekingen
> ==========================================
>
> laminfo output:
>
> LAM/MPI: 7.1.4
> Prefix: /usr/local
> Architecture: x86_64-unknown-linux-gnu
> Configured by: crieking
> Configured on: Thu Nov 15 10:44:12 CET 2007
> Configure host: linux-dgie
> Memory manager: ptmalloc2
> C bindings: yes
> C++ bindings: yes
> Fortran bindings: yes
> C compiler: gcc
> C++ compiler: g++
> Fortran compiler: g95
> Fortran symbols: double_underscore
> C profiling: yes
> C++ profiling: yes
> Fortran profiling: yes
> C++ exceptions: no
> Thread support: yes
> ROMIO support: yes
> IMPI support: no
> Debug support: no
> Purify clean: no
> SSI boot: globus (API v1.1, Module v0.6)
> SSI boot: rsh (API v1.1, Module v1.1)
> SSI boot: slurm (API v1.1, Module v1.0)
> SSI coll: lam_basic (API v1.1, Module v7.1)
> SSI coll: shmem (API v1.1, Module v1.0)
> SSI coll: smp (API v1.1, Module v1.2)
> SSI rpi: crtcp (API v1.1, Module v1.1)
> SSI rpi: lamd (API v1.0, Module v7.1)
> SSI rpi: sysv (API v1.0, Module v7.1)
> SSI rpi: tcp (API v1.0, Module v7.1)
> SSI rpi: usysv (API v1.0, Module v7.1)
> SSI cr: self (API v1.0, Module v1.0)
>
>
> ============================================
>
> ------------------------------------------------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails
> <http://www.trueswitch.com/yahoo-fr/> vers Yahoo! Mail
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/