# Problem to use a compiled library in a root script

**URL:** <https://root-forum.cern.ch/t/problem-to-use-a-compiled-library-in-a-root-script/53925>\
**Category:** Newbie\
**Tags:** graphics, root\
**Created:** [March 8, 2023, 8:22am UTC](https://root-forum.cern.ch/t/problem-to-use-a-compiled-library-in-a-root-script/53925 "2023-03-08T08:22:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_Tarbouriech](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/leo_tarbouriech/32/32139_2.png) [@Leo\_Tarbouriech](https://root-forum.cern.ch/u/Leo_Tarbouriech)\
**Post date:** [March 8, 2023, 8:22am UTC](https://root-forum.cern.ch/t/problem-to-use-a-compiled-library-in-a-root-script/53925/1 "2023-03-08T08:22:31Z")

</div>

I am trying to use a library to improve and simplify root graphics. For the moment I am doing the following program for testing.

```auto
  1 R__ADD_INCLUDE_PATH(/afs/cern.ch/user/l/ltarbour/PlottingHelper)
  2 #include "TCanvas.h"
  3 #include "TH1D.h"
  4 #include "TString.h"
  5 #include "plottingHelper.h"
  6 
  7 R__LOAD_LIBRARY(libPlottingHelper.so)
  8 
  9 namespace ph=PlottingHelper;
 10 using namespace std;
 11 
 12 void plot_TriggerCurves(std::string filename="2017H.root")
 13 {
 14 TFile *f = new TFile(filename.c_str());
 15 
 16 vector<double> x_edges{.2,1,.1,1,.1,1,.1,1,.1,1,.2};
 17 vector<double> y_edges{.2,2,.1,1,.2};
 18 
 19 TCanvas *c1 = new TCanvas();
 20 ph::DivideTransparent(x_edges, y_edges, true);
 21 }

```

And I am stuck with the following error message :

```auto
/afs/cern.ch/user/l/ltarbour/PlottingHelper/libPlottingHelper.so:1:585: error: source file is not valid UTF-8

```

I am executing this macro with `root -l plot_TriggerCurves.C`  
I uploaded the code of the library on the following git repository: [GitHub - zleba/PlottingHelper: Plotting utilities to make plotting in ROOT a bit easier](https://github.com/zleba/PlottingHelper)  
I compiled the it with `make`and the standard provided make file (I can provide the makefile if needed).

Where could this error come from? Should I force the encoding to be UTF-8, and how?

To be more specific I have the following questions:

1. I am using the environment CMSSW\_12\_2\_0 and the compiling architecture `slc7_amd64_gcc900`. I do not think that the library I am using was contracted in this context so could be the cause of the problem ?
2. What is the minimal content of a root make file? Is there a tutorial or root documentation for that? I would like to understand the different ways that root uses to compile a library, and how do write this in a make file. (I would like to check that the make file I have is OK, maybe simplify it)

Thank you in advance for any advice or information about the way ROOT works. Do not hesitate to ask for further information.

Best regards,  
Leo

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 8, 2023, 9:22am UTC](https://root-forum.cern.ch/t/problem-to-use-a-compiled-library-in-a-root-script/53925/2 "2023-03-08T09:22:18Z")

</div>

I would suggest you contact the author of this utility directly.
