# Garfield++ installation Cmake

**URL:** <https://root-forum.cern.ch/t/garfield-installation-cmake/41462>\
**Category:** Garfield++\
**Created:** [September 16, 2020, 2:36am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462 "2020-09-16T02:36:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhong](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/59ef9b/32.png) [@zhong](https://root-forum.cern.ch/u/zhong)\
**Post date:** [September 16, 2020, 2:36am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/1 "2020-09-16T02:36:52Z")

</div>

Hi  
I’m just beginning to learnGarfield++.  
I tried to install Garfield++ using this link [http://garfieldpp.web.cern.ch/garfieldpp/getting-started/](http://garfieldpp.web.cern.ch/garfieldpp/getting-started/),  
no errors were reported during the installation using the cmake GARFIELD\_HOME and make instructions.But when I tried to run Example/Gem,the following error occurred

 ![123](https://root-forum.cern.ch/uploads/default/original/3X/f/7/f7f3d99b2f9316a8a95503087bb19f7647eb7192.png) ![1234](https://root-forum.cern.ch/uploads/default/original/3X/7/7/77bb5d47635575de802fbd30a9f312f1048da6da.png)

So I used this way to Cmake,and successfully solved the problem

 ![微信截图_20200916101547](https://root-forum.cern.ch/uploads/default/original/3X/8/2/82e92704fc6ab17e169649d3238e7fae6f74a7f0.png)

BUT!!!When I ran a script written by a colleague(it can run successfully in his computer), the same error report came back!

 ![微信截图_20200916104021](https://root-forum.cern.ch/uploads/default/original/3X/a/d/ad5d45cd0c865c26bd14d4ce0d51cc376fef5710.png)  
Here is the makefile script:

![微信截图_20200916103316](https://root-forum.cern.ch/uploads/default/original/3X/4/6/464f9449a116dd207a35201ffdda55e9bf593114.png)

I don’t know what the problem is,looking forward to your reply  
Thanks!!

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [September 16, 2020, 6:36am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/2 "2020-09-16T06:36:15Z")

</div>

Hi,  
your colleague’s makefile was meant to be used with the old way of building Garfield (which was using different diretories), it won’t work with the CMake build. Can you try with the recipe in the second part of the instructions you posted, i. e. in your `TripleGEM` directory

- create a `build` folder (`mkdir build; cd build`)
- run CMake (`cmake ..`)
- build the application (`make`)

Also in your `avalancheV1.cc` program, please update the path to the Garfield headers, i. e. replace  
`#include "MediumMagboltz.hh"`  
by  
`#include "Garfield/MediumMagboltz.hh"`  
Let me know if it works.

---

<div class="post-metadata">

**Author:** ![zhong](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/59ef9b/32.png) [@zhong](https://root-forum.cern.ch/u/zhong)\
**Post date:** [September 16, 2020, 7:07am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/3 "2020-09-16T07:07:08Z")

</div>

Thank you so much for your reply！I used the scheme you mentioned, but there is no CMakeList.txt file

 ![微信截图_20200916150543](https://root-forum.cern.ch/uploads/default/original/3X/4/a/4a690b1f831abd2bce1055c791432e4f76e37dfb.png)  
Should I rewrite a new CMakeList.txt?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [September 16, 2020, 7:24am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/4 "2020-09-16T07:24:09Z")

</div>

Ah, yes, you can copy and adapt the one from the GEM example.

---

<div class="post-metadata">

**Author:** ![zhong](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/59ef9b/32.png) [@zhong](https://root-forum.cern.ch/u/zhong)\
**Post date:** [September 17, 2020, 11:10am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/5 "2020-09-17T11:10:11Z")

</div>

Hi I wrote a CMakeList.txt file and solved the problem successfully!  
The problem that had been bothering me for a week was finally solved!  
Thanks sooooo much for your help

---

<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:** [October 1, 2020, 11:10am UTC](https://root-forum.cern.ch/t/garfield-installation-cmake/41462/6 "2020-10-01T11:10:16Z")

</div>

Closed on October 1, 2020, 11:10am UTC

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