# Problem on compiling garfroot.c on ubuntu 12.10

**URL:** <https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285>\
**Category:** Garfield++\
**Created:** [February 27, 2014, 10:50am UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285 "2014-02-27T10:50:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![airy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@airy](https://root-forum.cern.ch/u/airy)\
**Post date:** [February 27, 2014, 10:50am UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/1 "2014-02-27T10:50:15Z")

</div>

Dear all,  
I’m trying to compile garfroot.c on my system but i get the following results:

> [@](#):
>
> `root-config --cxx` `root-config --cflags` -I/home/airy/WorkDir/garfield/Include -I/home/airy/WorkDir/garfield/Heed -fno-common -fPIC -O3 -W -Wall -Wextra -Wno-long-long -g -o garfroot garfroot.C -L/home/airy/WorkDir/garfield/Library -Wl,–whole-archive -lGarfield -Wl,–no-whole-archive -lgfortran `root-config --evelibs`  
> /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewCell.o): In function `Garfield::ViewCell::IsA() const': ViewCell.cc:(.text._ZNK8Garfield8ViewCell3IsAEv[_ZNK8Garfield8ViewCell3IsAEv]+0xc): undefined reference to `Garfield::ViewCell::Class()’  
> /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewCell.o):(.data.rel.ro.\_ZTVN8Garfield8ViewCellE[\_ZTVN8Garfield8ViewCellE]+0x1d0): undefined reference to `Garfield::ViewCell::ShowMembers(TMemberInspector&)' /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewCell.o):(.data.rel.ro._ZTVN8Garfield8ViewCellE[_ZTVN8Garfield8ViewCellE]+0x1d8): undefined reference to `Garfield::ViewCell::Streamer(TBuffer&)’  
> /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewGeometry.o): In function `Garfield::ViewGeometry::IsA() const': ViewGeometry.cc:(.text._ZNK8Garfield12ViewGeometry3IsAEv[_ZNK8Garfield12ViewGeometry3IsAEv]+0xc): undefined reference to `Garfield::ViewGeometry::Class()’  
> /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro.\_ZTVN8Garfield12ViewGeometryE[\_ZTVN8Garfield12ViewGeometryE]+0x1d0): undefined reference to `Garfield::ViewGeometry::ShowMembers(TMemberInspector&)' /home/airy/WorkDir/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro._ZTVN8Garfield12ViewGeometryE[_ZTVN8Garfield12ViewGeometryE]+0x1d8): undefined reference to `Garfield::ViewGeometry::Streamer(TBuffer&)’  
> collect2: error: ld returned exit status 1  
> make: \*\*\* [garfroot] Error 1

when I tried to [quote]make[/quote].

I also used the makefiles in the link [url][Garfield++ installation, garfroot.C - #5 by Francisco\_Molina](https://root-forum.cern.ch/t/garfield-installation-garfroot-c/15393/5) ,but still not working.

Can anyone tell me what’s the problem ???

---

<div class="post-metadata">

**Author:** ![odonnell](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/50afbb/32.png) [@odonnell](https://root-forum.cern.ch/u/odonnell)\
**Post date:** [March 24, 2014, 11:37pm UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/2 "2014-03-24T23:37:13Z")

</div>

try uncommenting the block of lines for the Garfield::ViewCell class in Include/LinkDef.h  
(a modified LinkDef.h is attached)  
[LinkDef.h](https://root-forum.cern.ch/uploads/default/original/2X/2/264ee147fa40fc1cf1785d40d2ff4b1cf02bfd91.h) (1.75 KB)

---

<div class="post-metadata">

**Author:** ![tstuttard](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/aca169/32.png) [@tstuttard](https://root-forum.cern.ch/u/tstuttard)\
**Post date:** [October 17, 2014, 12:40pm UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/3 "2014-10-17T12:40:20Z")

</div>

I have the same error messages when I am trying to compile a garfield++ project using ViewCell, e.g.

```auto
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewCell.o): In function `Garfield::ViewCell::IsA() const':
ViewCell.cc:(.text._ZNK8Garfield8ViewCell3IsAEv[Garfield::ViewCell::IsA() const]+0xc): undefined reference to `Garfield::ViewCell::Class()'
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewCell.o):(.data.rel.ro._ZTVN8Garfield8ViewCellE[vtable for Garfield:]+0x1d0): undefined reference to `Garfield::ViewCell::ShowMembers(TMemberInspector&)'
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewCell.o):(.data.rel.ro._ZTVN8Garfield8ViewCellE[vtable for Garfield:]+0x1d8): undefined reference to `Garfield::ViewCell::Streamer(TBuffer&)'
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewGeometry.o): In function `Garfield::ViewGeometry::IsA() const':
ViewGeometry.cc:(.text._ZNK8Garfield12ViewGeometry3IsAEv[Garfield::ViewGeometry::IsA() const]+0xc): undefined reference to `Garfield::ViewGeometry::Class()'
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro._ZTVN8Garfield12ViewGeometryE[vtable for Garfield::ViewGeometry]+0x1d0): undefined reference to `Garfield::ViewGeometry::ShowMembers(TMemberInspector&)'
/unix/muons/g-2/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro._ZTVN8Garfield12ViewGeometryE[vtable for Garfield::ViewGeometry]+0x1d8): undefined reference to `Garfield::ViewGeometry::Streamer(TBuffer&)'
collect2: ld returned 1 exit status
```

I have looked at the Link.h file as suggested but all linea are already uncommented in there. Are there any other recommendations for how to solve this?

Many thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![suaide](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@suaide](https://root-forum.cern.ch/u/suaide)\
**Post date:** [October 22, 2014, 7:14pm UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/4 "2014-10-22T19:14:35Z")

</div>

Hi Guys

I am having the same problem. Any news on this?

regards

Alex

---

<div class="post-metadata">

**Author:** ![aclavel](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@aclavel](https://root-forum.cern.ch/u/aclavel)\
**Post date:** [October 30, 2014, 11:00am UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/5 "2014-10-30T11:00:40Z")

</div>

Hello,

I have exactly the same compilation errors (see first message) with gcc 4.4.7 (and ROOT 5.34/18) on ubuntu 12.04 64 bit and gcc 4.6.3 (and ROOT 5.34/20) on CentOS 6.5 64 bit, using the garfield++ revision 353, the downloaded garfroot.C and the following downloaded makefile :

```auto
OBJDIR = $(GARFIELD_HOME)/Object
SRCDIR = $(GARFIELD_HOME)/Source
INCDIR = $(GARFIELD_HOME)/Include
HEEDDIR = $(GARFIELD_HOME)/Heed
LIBDIR = $(GARFIELD_HOME)/Library

# Compiler (and Linker)
CXX = `root-config --cxx`

# Compiler (and Linker) flags
CXXFLAGS = `root-config --cflags`
CXXFLAGS += -I$(INCDIR) -I$(HEEDDIR)
# Code Generation and Optimization flags
CXXFLAGS += -fno-common -fPIC -O3
# Warning flags
CXXFLAGS += -W -Wall -Wextra -Wno-long-long
# Debug flags
CXXFLAGS += -g

# Libraries (note: the order matters)
LDLIBS = -L$(LIBDIR) -Wl,--whole-archive -lGarfield -Wl,--no-whole-archive
# Fortran libraries
LDLIBS += -lgfortran
# ROOT libraries
LDLIBS += `root-config --evelibs`

garfroot: garfroot.C
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDLIBS)[/code]

```

The documentation indicates a Garfroot compilation fail known with gcc 4.7 or higher. I used various lower versions, so the gcc version is probably not the origin of this problem. The same error message is also present for me with an old version of garfield++ (revision 294).

Regards,  
Alexandre

---

<div class="post-metadata">

**Author:** ![FrederikWauters](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/ebca7d/32.png) [@FrederikWauters](https://root-forum.cern.ch/u/FrederikWauters)\
**Post date:** [November 6, 2014, 10:18pm UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/6 "2014-11-06T22:18:04Z")

</div>

I have the same problem compiling a simple.C (e.g. modifying the gasfile.C example ) program with ViewCell and ViewGeometry

`/home/fwauters/garfield/Library/libGarfield.a(ViewGeometry.o): In function `Garfield::ViewGeometry::IsA() const':
ViewGeometry.cc:(.text._ZNK8Garfield12ViewGeometry3IsAEv[Garfield::ViewGeometry::IsA() const]+0xc): undefined reference to `Garfield::ViewGeometry::Class()'
/home/fwauters/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro._ZTVN8Garfield12ViewGeometryE[vtable for Garfield::ViewGeometry]+0x1d0): undefined reference to `Garfield::ViewGeometry::ShowMembers(TMemberInspector&)'
/home/fwauters/garfield/Library/libGarfield.a(ViewGeometry.o):(.data.rel.ro._ZTVN8Garfield12ViewGeometryE[vtable for Garfield::ViewGeometry]+0x1d8): undefined reference to `Garfield::ViewGeometry::Streamer(TBuffer&)'
`

My Compiler: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)  
Linux distr: Scientific Linux release 6.5

---

<div class="post-metadata">

**Author:** ![youli](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/13edae/32.png) [@youli](https://root-forum.cern.ch/u/youli)\
**Post date:** [December 8, 2014, 5:19am UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/7 "2014-12-08T05:19:58Z")

</div>

you can try cmake, good luck

---

<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, 10:11am UTC](https://root-forum.cern.ch/t/problem-on-compiling-garfroot-c-on-ubuntu-12-10/17285/8 "2018-06-21T10:11:35Z")

</div>

Closed on June 21, 2018, 10:11am UTC

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