Mixed environment linking gfortran and gcc

sheldonrobinson sheldon.robinson@gmail.com
Wed Sep 23 19:08:00 GMT 2009


Need to add -lgfortranbegin to command line.
The library gfortranbegin.a is where the os specific functions are kept such
as _gfortran_internal_unpack, _gfortran_os_error.

It links ok after library was added.




sheldonrobinson wrote:
> 
> Fixed the first problem by restructuring the code so
> 
> CALL xDeriv(Q(K,0:Nx), dQdx(K,0:Nx), Nx, dx)
> 
> is now
> 
> 		DO K = 1,J
> 			u(0:Nx) = Q(0:Nx,K)
> 			CALL xDeriv(u, dudx, Nx, dx)
> 			dQdx(0:Nx,K) = dudx(0:Nx)
> 		END DO
> Now getting 
> error: undefined reference to `_gfortran_os_error'
> error: undefined reference to `_gfortran_runtime_error'
> 
> at the line
>  
> SUBROUTINE tDeriv(Q,dQdt,dQdx,Nt,Nx,dx,dt,J)
> 
> Anyone knows how to solve this problem
> 
> 
> 
> sheldonrobinson wrote:
>> 
>> I'm trying to link a fortran static library to a c++ main function the
>> command lines are found below.
>> 
>> I'm getting linker errors but the library versions are correct. Has
>> anyone had similiar problems
>> 
>> command lines
>> g++ -DNO_SYSTEM_GAMMA -DX_DISPLAY_MISSING -DINCLUDE_PNG_SUPPORT
>> -IC:\Libraries\plotutils-2.5\include -O0 -g3 -Wall -c -fopenmp
>> -fmessage-length=0 -Wpadded -Wpacked -malign-double
>> -mpreferred-stack-boundary=8 -omain.o ..\main.cc
>> 
>> g++ -LC:\Libraries\zlib-1.2.3 -LC:\Libraries\libpng-1.2.35\lib
>> -LC:\Libraries\plotutils-2.5\lib -LC:\Workspaces\NumericalPDE\fda\Debug
>> -fopenmp -oxDerivGraphs.exe main.o -lgfortran -lplotter -lfda -lpng -lz
>> 
>> Errors caused by following line
>> 
>> CALL xDeriv(Q(K,0:Nx), dQdx(K,0:Nx), Nx, dx)
>> 
>> error: undefined reference to `_gfortran_internal_unpack'
>> error: undefined reference to `_gfortran_internal_pack'
>> 
>> additional errors cause by following line
>> SUBROUTINE rkLs(Q, NEQNS, N, time, dx, dt)
>> 
>> error: undefined reference to `_gfortran_os_error'
>> error: undefined reference to `_gfortran_runtime_error'
>> 
>> 
>> 
>> sheldon robinson@SHELDON ~
>> $ gfortran --version
>> GNU Fortran (TDM-1 mingw32) 4.4.1
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> 
>> GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
>> You may redistribute copies of GNU Fortran
>> under the terms of the GNU General Public License.
>> For more information about these matters, see the file named COPYING
>> 
>> 
>> sheldon robinson@SHELDON ~
>> $ gcc --version
>> gcc.exe (TDM-1 mingw32) 4.4.1
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is
>> NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> PURPOSE.
>> 
>> 
>> sheldon robinson@SHELDON ~
>> $
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mixed-environment-linking-gfortran-and-gcc-tp25530934p25531257.html
Sent from the gcc - fortran mailing list archive at Nabble.com.



More information about the Fortran mailing list