Good morning, I have the following problem while interfacing g95 programs with g++:
fortran file: fortran_file.f
subroutine prova(var)
real var
write(*,*) var
end
g95 -c -fno-underscoring fortran_file.f
c++ main file: main.cxx
include <iostream>
using namespace std;
extern "C"{
void prova(float*);
}
main(){
float a = 2.;
prova(&a);
}
g++ main.cpp fortran_file.o
/usr/bin/ld: Undefined symbols:
__g95_filename
__g95_ioparm
__g95_line
__g95_st_write
__g95_st_write_done
__g95_transfer_real
collect2: ld returned 1 exit status
Following the suggestions on g95 web site I used the g95_runtime_start function
void g95_runtime_start(int argc, char *argv[]), but the ld cannot resolve it. Is there one who can give me any suggestions?
fortran file: fortran_file.f
subroutine prova(var)
real var
write(*,*) var
end
g95 -c -fno-underscoring fortran_file.f
c++ main file: main.cxx
include <iostream>
using namespace std;
extern "C"{
void prova(float*);
}
main(){
float a = 2.;
prova(&a);
}
g++ main.cpp fortran_file.o
/usr/bin/ld: Undefined symbols:
__g95_filename
__g95_ioparm
__g95_line
__g95_st_write
__g95_st_write_done
__g95_transfer_real
collect2: ld returned 1 exit status
Following the suggestions on g95 web site I used the g95_runtime_start function
void g95_runtime_start(int argc, char *argv[]), but the ld cannot resolve it. Is there one who can give me any suggestions?