# Makefile error: root-config --libs --cflags

**URL:** <https://root-forum.cern.ch/t/makefile-error-root-config-libs-cflags/47537>\
**Category:** Newbie\
**Created:** [November 4, 2021, 4:12pm UTC](https://root-forum.cern.ch/t/makefile-error-root-config-libs-cflags/47537 "2021-11-04T16:12:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MicheleScattola](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/michelescattola/32/27810_2.png) [@MicheleScattola](https://root-forum.cern.ch/u/MicheleScattola)\
**Post date:** [November 4, 2021, 4:12pm UTC](https://root-forum.cern.ch/t/makefile-error-root-config-libs-cflags/47537/1 "2021-11-04T16:12:26Z")

</div>

#Root version and compilers at the bottom of the post

thanks in advance for any help, I am fairly new to ROOT since we are starting to use it in my university class so forgive me if I did any basic mistake. I tried to troubleshoot as best as I could but couldn’t find a proper answer.  
I am trying to compile some code in C++ (main.cpp) which is meant to include the following root headers which I implemented in main in this way:

```auto
#include "TH1F.h"
#include "TApplication.h"
#include "TCanvas.h"
#include "TGraph.h"

```

the makefile looks like this: (the relevant parts)

```auto
myClasses:=../etc.. #this compiles correctly
LIBS:='root-config --libs'
INCS:='root-config --cflags'

main: main.o ${myClasses}
	g++ main.o ${myClasses} ${INCS} ${LIBS} -o main 

main.o: main.cpp ../Classes/Posizione.h ../Classes/CampoVettoriale.h
	g++ -c main.cpp ${INCS} ${LIBS} -o main.o 

```

My .bashrc file looks like this:

```auto
export ROOTSYS=/home/michele/Documents/Informatica/ROOT/root
export PATH=$PATH:$ROOTSYS/bin
export LD_LIBRARY_PATH=$ROOTSYS/lib/:$LD_LIBRARY_PATH

```

Note: the library paths and the general {INCS} {LIBS} commands work for another exercise in another folder so they must be correct. This exercise I have trouble on just has a more complicated header inclusion and therefore a more “complicated” makefile

Once I try to compile with make I get the following error in the terminal:

```auto
g++ -c main.cpp -o main.o 'root-config --cflags' 'root-config --libs'
g++: error: root-config --cflags: No such file or directory
g++: error: root-config --libs: No such file or directory
make: *** [makefile:10: main.o] Error 1

```

Note: line 10 in makefile is the following:

```auto
	g++ -c main.cpp -o main.o ${INCS} ${LIBS}

```

The strange thing is that if I execute in the terminal root-config --cflags or root-config --libs I get a positive outcome with the libraries being listed etc. and as I stated before it works properly in another exercise.  
Final Note: Visual studio code does give me a “warning” on the #include in main.cpp but I haven’t changed anything in the installation of root or something related to that

[ROOT has been installed properly in the ROOTSYS path and I have tried also to re-execute source root/bin/thisroot.sh]

_ROOT Version:_ 6.24/06  
\_Platform:\_Ubuntu 21.04  
_Compiler:_ g++

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [November 4, 2021, 4:21pm UTC](https://root-forum.cern.ch/t/makefile-error-root-config-libs-cflags/47537/2 "2021-11-04T16:21:45Z")

</div>

Use " ` " instead of " ’ ".  
Or use: `$(root-config --cflags)`

---

<div class="post-metadata">

**Author:** ![MicheleScattola](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/michelescattola/32/27810_2.png) [@MicheleScattola](https://root-forum.cern.ch/u/MicheleScattola)\
**Post date:** [November 4, 2021, 4:24pm UTC](https://root-forum.cern.ch/t/makefile-error-root-config-libs-cflags/47537/3 "2021-11-04T16:24:25Z")

</div>

wow I must have not noticed it was ` while re-arranging the code in the makefile. Thanks for the quick response!  
I will hide the post since it’s been solved, thanks again
