# Makefile Garfield

**URL:** <https://root-forum.cern.ch/t/makefile-garfield/17475>\
**Category:** Garfield++\
**Created:** [April 7, 2014, 1:03pm UTC](https://root-forum.cern.ch/t/makefile-garfield/17475 "2014-04-07T13:03:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliolfateh](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/958977/32.png) [@aliolfateh](https://root-forum.cern.ch/u/aliolfateh)\
**Post date:** [April 7, 2014, 1:03pm UTC](https://root-forum.cern.ch/t/makefile-garfield/17475/1 "2014-04-07T13:03:01Z")

</div>

Hi  
I want to compile a code with Garfield++(simulation application).  
When i make it with this makefile:  
gemseq1: gemseq1.C  
g++ -c -O3 `root-config --cflags` -I$(GARFIELD\_HOME)/Include gemseq1.C  
g++ `root-config --glibs` -lgfortran -lm -lz -o gemseq1 gemseq1.o $(GARFIELD\_HOME)/Library/libGarfield.a  
rm gemseq1.o  
my system responds like this:  
…  
magboltz-9.01.f:(.text+0xe93e8): undefined reference to `_gfortran_transfer_real' magboltz-9.01.f:(.text+0xe93f9): undefined reference to`\_gfortran\_transfer\_real’  
magboltz-9.01.f:(.text+0xe940a): undefined reference to `_gfortran_transfer_real' /home/ali/garfield/Library/libGarfield.a(magboltz.o):magboltz-9.01.f:(.text+0xe941b): more undefined references to`\_gfortran\_transfer\_real’ follow  
/home/ali/garfield/Library/libGarfield.a(magboltz.o): In function `readin_': magboltz-9.01.f:(.text+0xe9445): undefined reference to`\_gfortran\_st\_read\_done’  
magboltz-9.01.f:(.text+0xe9484): undefined reference to `_gfortran_st_read' magboltz-9.01.f:(.text+0xe9496): undefined reference to`\_gfortran\_transfer\_real’  
magboltz-9.01.f:(.text+0xe94ae): undefined reference to `_gfortran_transfer_real' magboltz-9.01.f:(.text+0xe94bf): undefined reference to`_gfortran\_transfer\_real’  
magboltz-9.01.f:(.text+0xe94c7): undefined reference to `_gfortran_st_read_done' /home/ali/garfield/Library/libGarfield.a(magboltz.o): In function`magboltz2_’:  
magboltz-9.01.f:(.text+0xe97ce): undefined reference to `\_gfortran\_stop\_string’  
collect2: error: ld returned 1 exit status  
make: \*\*\* [gemseq1] Error 1

Any help will be appreciated,

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [April 8, 2014, 12:22pm UTC](https://root-forum.cern.ch/t/makefile-garfield/17475/2 "2014-04-08T12:22:52Z")

</div>

Hi,

this does not seem to be a ROOT related issue, rather a compilation one.  
Out of curiosity, did you try link using gfortran?

Danilo

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [January 31, 2017, 9:39am UTC](https://root-forum.cern.ch/t/makefile-garfield/17475/3 "2017-01-31T09:39:31Z")

</div>

Try:

```auto
g++ `root-config --cflags` -o gemseq1 gemseq1.o $(GARFIELD_HOME)/Library/libGarfield.a `root-config --glibs` -lgfortran -lm -lz

```

or:

```auto
g++ `root-config --ldflags` -o gemseq1 gemseq1.o $(GARFIELD_HOME)/Library/libGarfield.a `root-config --glibs` -lgfortran -lm -lz

```

---

<div class="post-metadata">

**Author:** ![muzamilramzan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@muzamilramzan](https://root-forum.cern.ch/u/muzamilramzan)\
**Post date:** [January 31, 2017, 11:43am UTC](https://root-forum.cern.ch/t/makefile-garfield/17475/4 "2017-01-31T11:43:06Z")

</div>

Thanks it worked

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 21, 2018, 9:12am UTC](https://root-forum.cern.ch/t/makefile-garfield/17475/5 "2018-06-21T09:12:26Z")

</div>

Closed on June 21, 2018, 9:12am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
